???? ?? ??? ??? PHP ??? ?? ?? ? ?? ?? ??? 1/5
Jul 29, 2016 am 08:37 AM?? ?? ??? ????? ??, ?? ?? ??? ???? ? ?????. ??, ?? ?? ??? ?? ??? ??? ???? ?? ??? ????? ?? ??, ?? ?? ? ????? ????.
????? ??? ??? ?? ??? ??? ???? ????. ???? ?? ??? ??? ?? ? Customer? ???? SKU? ???? ??? ????. ? ??? ?? ? ???, ?? "??? ? ??"?? ?? ?? ??? ?? ??? ? ????.
????? ?? ??? ??? ???? ??? ?? ? ?? ??? ?? ??? ????? ????. ???? ?? ???? ?????. (? ???? ??? ??? ??? BadDollar?? ??? ?????.) ??? ?? ????? ???? ??? ?? ? ??? ??????.
// PHP5
class BadDollar {
protected $amount;
public function __construct($amount=0) {
$this->amount = (float)$amount; >}
?? ?? getAmount() {
return $this->amount;
}
?? ?? add($dollar) {
$this->amount = $dollar- >getAmount();
}
}
class Work {
protected $salary; public function __construct() {
$this->salary = new BadDollar(200);}
public function payDay() {
return $this->salary;
}
}
class Person {
public $wallet
}
function testBadDollarWorking () {
$job = new Work
$p1 = new Person
$p1->wallet = $job->payDay(); ??>$this->assertEqual(200, $p1->wallet->getAmount())
$p2->wallet = $job->payDay()
$this- >assertEqual(200, $p2->wallet->getAmount())
$p1->wallet->add($job->payDay())
$this- >assertEqual(400, $p1->wallet->getAmount());
//??? ?? ????. ???? 400???.
$this->assertEqual(200, $p2->wallet- >getAmount());//?? ?? ????. ???? 400
$this->assertEqual(200, $job->payDay()->getAmount())
}
?? ??? ???? ?? ?? ???? ??? ????? ???? ??? ?? ?? ?????. ?? ?? $p1? ?? $p2? ??? BadDollar ?? ????? ?????.
?? Work ???? Person ???? ????? ???????. ??? ? ??? ??? ? ????? ??? ??? ???? ?? ??? ????? Person:wallet? Work::payDay() ???? ??? ?? ?? ??? ?? ????? BadDollar ???? ?? ????? ?????. .
??? PHP5? ?? ?? ??? ??????? ?? ??? PHP5?? ???? ???? ?? ?? ?? ??? ??? ? ?? ????? $job::salary, $p1::wallet ? $p2::wallet? ?? ?? "???"? ????? ???? ?? ??? ?? ????.
??? ?? ?? ?? ??(PayDay? ??? ???? ?? ???? ???? ??? ???? ??? ???)?? $job->payDay()? ???? ??? $P1? ??? ????? ????. , ??? ???? $P2? ???????. ??, ? ??? ?? ?? ??? ?? ?? ??? ?????. ??? ??? ? ?? ???? ??? ?????.
? ?? PHP5 ?? ???
1) [Integer: 200]? [Float: 400]? 200?? ??? ??? ?? ??? ?????.
in testBadDollarWorking
ValueObjTestCase
2) ?? ??? ???? ??? ??? ????. [Integer: 200]? [Float: 400]? 200?? ????
testBadDollarWorking
ValueObjTestCase
??!!!
?? ??? 1/5 12345?? ???
???? ???? ??? ???? ???????. PHP ??? ?? ?? - Value Object Pattern 1/5???? ???? ??? ???? ??? ???? ?? PHP ????? ??? ?? ????? ??? ???? ?????.

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

??? ??











ToversionAphp ??, forclarityandeasofrouting, ac

TOSECURELYHANDLEAUSTENCENDACTIONANDACTERIZINGINPHP, FORCUCTSESTEPS : 1. ALWAYSHASHPASSWORTHPASSWORD_HASH () ? VERVERIFYUSINGPANSWORD_VERIFY (), usePREPAREDSTATEMENTSTOPREVENTSQLINGERGED, andSTOREUSERSESSEATAIN $ _SESSIONSAFTERLOGIN.2.impleplempletrole ?? ACCESSC

ProceduralAndObject-OrientedProgramming (OOP) InphpDiffersiMINTIFINTIONTERINGLISTURE, ??? ? ? DATAHANDLING

phpdoesnothaveAbuilt-inweakMapButofferSweakReference.1.WeakReenceAllowsholdingReferences withoutpreventinggarbageCollection.2.ItusteForCaching, Eventlisteners, andMetAdataWithoutAftingObjectLifeCycles.3.youcoucococococococcinccing

PHP?? ?? ???? ???? ????? ??? ?? ??? ???? ?? ??? ??? ??? ???? ????. 1. finfo_file ()? ???? ?? ?? ??? ???? ???/jpeg? ?? ?? ?? ? ?????. 2. uniqid ()? ???? ??? ?? ??? ???? ? Web ?? ????? ??????. 3. php.ini ? html ??? ?? ?? ??? ???? ???? ??? 0755? ?????. 4. Clamav? ???? ???? ???? ??? ??????. ??? ??? ?? ???? ????? ???? ?? ??? ????? ???? ??? ? ??? ?????.

PHP?? ==? ==? ?? ???? ?? ??? ??????. == ?? ??? ?? ?? ?????. ?? ??, 5 == "5"? true? ????, ?? ??? ???? ?? ?? ??? ????? ????? (? : 5 === "5"? false? ?????. ?? ?????? ===? ? ???? ?? ?????? == ?? ??? ??? ???? ?????.

?, PHP? ?? ?? ?? ?????? ?? MongoDB ? Redis? ?? NOSQL ??????? ?? ??? ? ????. ?? MongoDBPHP ???? (PECL ?? Composer? ?? ??)? ???? ????? ????? ??? ?????? ? ???? ????? ??, ??, ?? ? ?? ??? ?????. ??, Predis ????? ?? Phpredis ??? ???? Redis? ???? ?? ? ?? ? ??? ???? ??? ????? Phpredis? ???? ?? Predis? ?? ??? ?????. ? ? ?? ??? ???? ? ????? ????.

PHP?? ?? ??? ??? ???? ??? ??? ????. 1. ?? ??? ?? ? ?? ??? ??? ???? ???? ??? ? ????. ??? ??? ???? ????? ????? ???? ????. 2. ?? ?? ?? - ??, ??? ???? ?? ??? ?????. 3. ?? ???? ??? ??? ???? ??? ??? ?????. 4. Division? / ??? ???? 0?? ??? ?? ????? ??? ?? ??? ?? ? ? ????. 5. ???? ??? ???? ?? ?? ? ?? ??? ???? ? ??? ? ???, ??? ?? ? ? ??? ??? ???? ?????. ? ???? ???? ???? ??? ??? ??? ???? ?? ??? ? ??????? ????.
