PHP:Function name must be a string in...求解,难道后台不能这样写?
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP:Function name must be a string in...求解,难道后台不能这样写?相关的知识,希望对你有一定的参考价值。
参考技术A 应该这样写后台?php
$operation=$_GET['operation'];
$name=$_GET['name'];
if($operation && $name) echo 'success';
?
错误的原因是:
$_GET('name')这样写的话,php首先认为你的get()是一个function,
但是前面又有$符号,这在php中他又认为这是一个变量,
但是变量是不能作为一个function的,所以抛出错误Function
name
must
be
a
string
$_GET['xxx']是其他系统变量都是用的方括号而非括弧,这点要注意下(例如
$_POST['xxx'],$_FILE['xxx']等等) 参考技术B 应该这样写后台
?php
$operation=$_get['operation'];
$name=$_get['name'];
if($operation
&&
$name)
echo
'success';?
错误的原因是:
$_get('name')这样写的话,php首先认为你的get()是一个function,
但是前面又有$符号,这在php中他又认为这是一个变量,
但是变量是不能作为一个function的,所以抛出错误function
name
must
be
a
string
$_get['xxx']是其他系统变量都是用的方括号而非括弧,这点要注意下(例如
$_post['xxx'],$_file['xxx']等等)
Error creating bean with name xxxx,xxxx must be provided
原因: 继承父类的bean注入是set,get方法
问题: 自己的controller不能创建,因为需要的bean没有创建
解决方法: bean 注入,通过构造函数调用父类的set方法
以上是关于PHP:Function name must be a string in...求解,难道后台不能这样写?的主要内容,如果未能解决你的问题,请参考以下文章