ThinkPHP框架,该怎么处理

WBOY
Release: 2016-06-13 13:37:15
Original
958 people have browsed it

ThinkPHP框架
index的
class IndexAction extends Action{
  public function index() { 
  $Demo = new Model('thinkphp'); // 实例化模型类 
  print_r($Demo);
  $list = $Demo->select(); // 查诟数据 
  $this->assign('list',$list); // 模板发量赋值 
  $this->display(); // 输出模板 
  }

?>

 
编号:{$vo.id}
 
标题: {$vo.text}
 
内容: {$vo.nr}


 
 

为啥不显示数据呢

------解决方案--------------------
这个你自己配debug调试下吧,笨点就在几个位置print出来看看是哪里出了问题
------解决方案--------------------
Runtime/log文件夹下有日志,你看看里面的sql语句神马的,看看哪错了,还不知道就把日志贴出来看看。
------解决方案--------------------
最简单的方法是
$list = M('Thinkphp')->select();

如果想要判断sql是否正确
直接打印 echo $dao->getLastSql();
------解决方案--------------------
你要先定位错误, 看哪个变量没有需要的值,编程基本功啊
------解决方案--------------------
$vo['id']
$vo['text']
试试、、
以前我好像也试过类似的错误,忘记了……

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!