?? CakePHP 4.x? ????? CakePHP 3.x ??????? ????. ? ??? ???? ??? PHP 7?? PHP 8? ??????.
?? ????? ?? ??? ???? ?? ?? ??????.
? ??????? ?? ??? ???????? ??? ?? Redis? ???? ????. ?? ? ??? ???? ?? ??? ??? ??? ??? ????? ?????. ?? ???? ?? ???? Redis? ??? ?? ?? ???? input
??? ?? ??? ?????. ?, ???? ???? ?? ?? ? ???? ?? ??? ?? ?? ??? ??? ???? ? ? ????.
input
CakePHP 3.x ????????
???
$form_fields
數(shù)組包含模板中 input
$form_fields
???? ????
???
$user_search
是從 Redis 獲取并反序列化的數(shù)據(jù)數(shù)組。例如,我們可能有 $user_search['f1']
和 $user_search['f3']
包含 Redis 數(shù)據(jù); f2
??? ?? ??? ??? ?? ????. ? ?? ???? ?? ??? ???? ???? ??? ???
??? Cake 3.x ????????? ?? ??? ??? ?????. ???? ?? ???? ??
?? ???? ??? ?? ??? ?????. ?? ?? ? ????? ??? ?? ?????.
???
f1
,“bar”為 f3
。 f2
中沒有任何內(nèi)容,因此根據(jù) : '';
?? "foo"? ?? ??? ????
CakePHP 4.x ????????? ???? ?? ??? ? ?? ?? ??? ???? ????. ??? ??? ? ???? "test" ???? ??? ???? ??? ???? ? ???? ???? ???? ??????. : '';
條件修改為 : 'test';
p>???? Redis? ????,
? ?? ??? ??? ???? ??? ??????. ?, ???? ???? ???? ?? ??????. $user_search
?? ??? ?? ?? ???? ????. ??? ?? ???? ??? ? ????. ? ???? ??? ???? getData()
?? ????.
?? PHP?? ??? ?? ??
? ?????. ???
?? ?? ? ??? PHP?? ???? ??? ?? ??? ???? ?? ???? ??/???? ? ????. ??? ??? ?? ??? ?? ??? ?????.???? ??? ?? ???? ??? ??? ??? ??? Ajax ??? ?? ????? ?????. ???? ?? ?? ??? ???? ???? ?? ?? ???? ????? ?? ??? ???? ??? ??? ?????. ? ??? ???? ?? ??? ? ?????. ? ?? ???? ?? ???? ?? ??? ??? ??? ?? ??? ????.
??? ?? ?? ??? withData
。請記住,請求對象是不可變的,因此您需要將該函數(shù)調(diào)用的結(jié)果分配回請求對象,例如與$this->setRequest($this->getRequest()->withData('f1', 'foo')->withData('f3', 'bar'))
???.