Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要递归调用一个变量函数,我该怎么做?
$rec = function($li) use($html,$rec) { // error, rec was not defined yet if( ... ) $rec( ... ); }
我怎样才能做到这一点?
$rec通过引用 ( )使用函数变量,&$rec以便您可以将其设置为函数。这也将定义它。
$rec
&$rec
use($html, &$rec) ^
您可以在Anonymous recursive PHP functions问题中找到该原则。