用户
 找回密码
 入住 CI 中国社区
搜索
查看: 2100|回复: 1
收起左侧

[HELP] 遇到一个ID模板传值的问题

[复制链接]
发表于 2012-1-14 18:19:50 | 显示全部楼层 |阅读模式
PHP部分
$id = $this->input->get('id');
if($id){
        $data['links_detail'] = $this->links->get_by_id($id);
}
$this->parser->parse('admin/system_links_list.html',$data);
html部分
<input name="name" type="text" value="<?=$links_detail['linkname']?>">

这是一个列表+编辑的页面,当我不给ID的时候会报错,
Severity: Notice

Message: Undefined variable: links_detail

Filename: admin/system_links_list.html
那为什么TP或者其他框架不会有这问题啊?
发表于 2012-1-14 22:47:34 | 显示全部楼层
Severity: Notice
Message: Undefined variable:

与框架无关  设置下 error_reporting
CI   ENVIRONMENT 默认为 development, 而development环境的报错默认为error_reporting(E_ALL);
这里是用户根据需要自己设置的 (在index.php)  如果你想屏蔽掉 Notice 级别的信息,
把error_reporting(E_ALL);改成 error_reporting(E_ALL ^ E_NOTICE);

参考:
http://www.php.net/manual/zh/function.error-reporting.php

本版积分规则