我收到致命错误:
函数名必须是字符串
当尝试return $redirect()->to(blah blah blah...
if($act=="ban"){
$ban_until = $request->input('ban_until');
if(Ragnarok::temporarilyBan($account_id,$banned_by,$ban_until,$ban_reason)){
return $redirect()->to('banlist');
}else{
return $redirect()->to('banlist')->withErrors('Failed to ban, database error');
}
}else if($act=="unban"){
if(Ragnarok::unBan($account_id,$banned_by,$ban_reason)){
return $redirect()->to('banlist');
}else{
return $redirect()->to('banlist')->withErrors('Failed to unban, database error');
}
}
Run Code Online (Sandbox Code Playgroud)
有人面临这个错误吗?
$尝试从函数中删除:
redirect()->to('banlist');
Run Code Online (Sandbox Code Playgroud)
PHP 函数必须以字母或下划线开头,您错误地将 a 添加$到函数中。
来自 PHP 文档:
函数名称遵循与 PHP 中其他标签相同的规则。有效的函数名称以字母或下划线开头,后跟任意数量的字母、数字或下划线。作为正则表达式,它可以表示为:[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*。
http://php.net/manual/en/functions.user-define.php
| 归档时间: |
|
| 查看次数: |
27199 次 |
| 最近记录: |