下面是thinkphp3.2.3框架写的一个方法,请帮我检查其中的错误 public function approvalFlow(){ $nodes = M('nodes'); //var_dump($where); // 查询数据,$username为得到数据存储的变量 //select查询返回所以数据,find只取一条数据。 $usernames = $nodes->where('status',0)->select(); var_dump($usernames); }
时间: 2024-01-25 08:02:07 浏览: 139
在这个代码中,存在一个语法错误,where方法需要传递一个数组作为参数,而不是直接传递一个字符串。应该使用以下代码:
```
$nodes = M('nodes');
$usernames = $nodes->where(array('status'=>0))->select();
var_dump($usernames);
```
另外,建议在使用var_dump()函数之前添加一个header()函数,以便正确显示输出的内容。例如:
```
header("Content-type:text/html;charset=utf-8");
var_dump($usernames);
```
阅读全文