¡¶Head First Éè¼Æģʽ¡·´úÂëÖ®PHP°æ
¡¶Head First
Éè¼Æģʽ¡·ÊDZ¾²»´íµÄ½²½âÉè¼ÆģʽµÄÊ飬²»ÏñF4дµÄÄÇô¿ÝÔӦ¸ÃËãÊDZȽÏÈÝÒ×Àí½âµÄºÃÊé¡£ÊéÖеÄÀý×Ó¶¼±È½ÏdzÏÔÒ׶®£¬²»¹ýÓÉÓÚÊÇÍâ¹úÀÐдµÄ£¬ËùÒÔÀý×Ó
µÄÏ°¹ß²»ÊǺܸ½ºÏÖйúÌØÉ«£¬¿ÉÄÜż¶û¿´ÆðÀ´ÓÐЩ±ðŤ£¬»¹ÓÐÓïÑÔÏ°¹ßÒ²²»ÊÇÖйú·ç¡£µ±È»¿´¹ýÕâ±¾ÊéÖ®ºó£¬Äã²ÅÄÜÉî¿ÌÀí½âÉè¼Æģʽµ½µ×ÄÜΪÄã½â¾öÄÄЩ
Ì⣬²»ÄÜΪÄã½â¾öÄÄЩÎÊÌ⣨±ÈÈç²»ÄÜ´úÌæÄãµÄ±àÂ룩¡£
²ßÂÔģʽ
<?php
/**
* ²ßÂÔģʽ
* ¶¨ÒåÁËËã·¨×壬·Ö±ð·â×°ÆðÀ´£¬ÈÃËüÃÇÖ®¼ä¿ÉÒÔ»¥ÏàÌæ»»£¬
* ´ËģʽÈÃËã·¨µÄ±ä»¯¶ÀÁ¢ÓÚʹÓÃËã·¨µÄ¿Í»§¡£
*/
//·ÉÐÐÐÐΪ½Ó¿Ú
interface FlyBehavior {
public function fly();
}
//ßÉßɽÐÐÐΪ½Ó¿Ú
interface QuackBehavior {
public function quack();
}
//³á°ò·ÉÐÐ
class FlyWithWings implements FlyBehavior {
public function fly() {
echo "I'm flying!!\n";
}
}
//²»»á·É
class FlyNoWay implements FlyBehavior {
public function fly() {
echo "I can't fly!\n";
}
}
class FlyRocketPowered implements FlyBehavior {
public function fly() {
echo "I'm flying with a rocket!\n";
}
}
class Qquack implements QuackBehavior {
public function quack() {
echo "Quack\n";
}
}
class Squeak implements QuackBehavior {
public function quack() {
echo "Squeak\n";
}
}
class MuteQuack implements QuackBehavior {
public function quack() {
echo "<< Silence >>\n";
}
}
abstract class Duck {
protected $quack_obj;
protected $fly_obj;
public abstract function display();
public function performQuack() {
$this->quack_obj->quack();
}
public function performFly() {
$this->fly_obj->fly();
}
public function swim() {
echo "All ducks float, even decoys!\n";
}
public function setFlyBehavior(FlyBehavior $fb) {
$this->fly_obj = $fb;
}
public function setQuackBehavior(QuackBehavior $qb) {
$this->quack_obj = $qb
Ïà¹ØÎĵµ£º
ÎÊÌâÃèÊö£º
´Óphp½çÃæinsertÊý¾Ýµ½mysql£¬Ö»ÄÜÊäÈëżÊý¸öºº×Ö²»ÄÜÊäÈëÆæÊý¸öºº×Ö£¬ÊäÈëÆæÊý¸öºº×ֺ󱨓Data too long for column ”´íÎ󣬲¢Ã»Óиü¸ÄÊý¾Ý¿âÊý¾Ý¡£µ½Êý¾Ý¿â²é¿´£¬·¢ÏÖºº×Ö¶¼ÊÇÂÒÂë¡£µ«ÊÇphp½çÃæÏÔʾºº×ÖÕý³££¨µ±È»ÏÔʾµÄ¶¼ÊÇżÊý¸öºº×Ö£¬ÆæÊý¸öºº×Ö¶¼Ã»ÓÐдÈëÊý¾Ý¿â£©¡£
½â¾ö˼·£º
1.¸ü¸Ämy.i ......
ÔÚÕ⼸ÌìµÄ¹¤×÷¹ý³ÌÖУ¬ÐèҪʵÏÖPHPÔÚ·þÎñÆ÷¶ËÄÜÓëÆäËû³ÌÐòͨÐÅ¡£ºÍÀϺÎÁ©ÈËÑо¿ÁË°ëÌ죬ÖÕÓÚ´óÖÂŪ³öÁËÒ»¸öÓÃWINDOWSµÄÃüÃû¹ÜµÀͨÐŵķ½·¨¡£
Óм¸µãÐèҪעÒâµÄ£º
PHP·þÎñÆ÷¶ËÎÒÃÇÿ´Î¶¼ÊÇÖØйҽÓÃüÃû¹ÜµÀ¡££¨ÕâÑùд£¬PHP¶Ë´úÂëÁ¿¼«ÆäÉÙ£¬¶øÇÒÒ²ºÜ·½±ã¡££©
ÄÇôÎÒÃÇÓÃC/C++дµÄÃüÃû¹ÜµÀ·þÎñÆ÷ÔòÐèҪÿ´ÎͨÐŶ¼´´½¨Ò»´Î¹ ......
/*
author: yangyu@sina.cn
description: ½»»»Êý×éÖÐÁ½¸öÔªËصÄλÖã¬ÔªËØ°üÀ¨keyºÍvalue£¬¾ßÌåÓ÷¨¼ûÏÂÃæµÄÀý×Ó
*/
$arr = array(11=>'a',22=>'b',33=>'c',44=>'d');
$res = array_exchange($arr, 11 ,33);
//example:
echo '<pre>';print_r ($res);echo '</pre>';
function array_excha ......
±¾ÈËÕýÔÚ¿ª·¢Ò»Ì×¹ÉƱϵͳ£¬ÔÚÊý¾ÝºÍËã·¨·½ÃæÒѾûÓÐÎÊÌ⣬ÏÖÑ°ÕÒÒ»ÃûÊìÁ·µÄPHP Web¿ª·¢ºÏ×÷ÈËÔ±£¬ÒªÇóÈçÏ£º
1.ÊìϤPHP+MySQL¿ª·¢£»
2.Äܹ»Éè¼ÆÖÆ×÷ÃÀ¹ÛµÄ½çÃ棻
3.Äܹ»ÔÚϵͳÖÐÊìϤʹÓÃAjaxЧ¹û£»
4.ÊìϤÍøÉÏÖ§¸¶£¨Ö§¸¶±¦¡¢²Æ¸»Í¨»òÆäËû£©£»
5.ÊìϤÈËÈËÍø¡¢Ð£ÄÚ¡¢ÂþÓѵÈSNS¿ª·Åƽ̨¿ª·¢ÕßÓÅÏÈ£»
6.ÒªÇóÈËÔÚÉϺ££¬Ó ......
»¹ÊÇ
²¿ÃÅÎÞÁĵĿ¼Ì⣬²»¹ýÕâ´Î¿¼µÄÊÇ PHP
µÄÄÜÁ¦¡£ÌâÄ¿ÈçÏ£º
¸øÄãÁ½¸ö·Ö±ðÓÐ 5000 ¸öÔªËصÄÊý×飬¼ÆËãËûÃǵIJ
-- ˵°×ÁËÒ²¾ÍÊÇÓà PHP ºÍÄãÈÏΪ×îºÃµÄË㷨ʵÏÖ array_diff µÄËã·¨¡£
³õ´Î½Óµ½Õâ¸öÌâÄ¿£¬ÎÒ·¢ÏÖÕâ·Ç³£µÄ¼òµ¥£¬
ÓÚÊÇ°´ÕÕÒÔÍùµÄ¾Ñé“Ëæ±ã”дÁËÒ»¸ö£º
function array_diff($array_1, $ ......