我有一个使用 php mysql 动态 TreeView 的代码。
function fetchCategoryTreeList($parent = '', $user_tree_array = '')
{
// code here
}
我只是想要...就像。我有一个变量
$top = '1234';
现在如何放入这个函数
function fetchCategoryTreeList($parent = $top, $user_tree_array = '')
{
// code here
}
如果我将 $top 放入此函数中,则会出现 fatal error 。请帮助我
最佳答案
您不能将默认值作为另一个变量分配给参数。您可以使用常量代替
define("TOP", "1234");
function fetchCategoryTreeList($parent = TOP, $user_tree_array = '')
{
// code here
}
关于php - 使用php创建动态树,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45253287/