[8] Undefined index: UserId 错误 解决方案 thinkphp3.2
来源:互联网 发布:代销下单与传淘宝 编辑:程序博客网 时间:2024/05/24 03:29
今天在写心理网站的时候,重新建立了一个包,一开始测试了一下,可是总是出现[8] Undefined index: UserId 错误,我疯了1个小时,之后又去吃个饭,回来之后才[[[不小心]]]测试成功了。
控制器:
<?phpnamespace Home\Controller;use Think\Controller;class IndexController extends Controller { public function index(){ $data = M('user'); $user = $data->select(); $this->assign('user',$user); $this->display(); }}首页:
<foreach name="user" item="vo"> {$vo.UserId}-{$vo.UserName}<br> </foreach>然后运行之后
SQL显示是正确的,就只有页面代码的UserId和UserName出现了问题,之后我就在这里去找,可是我当时也傻了,虽然在数据库里
是这样创建的,但是是不能这样理解的,正确的写法是:
<foreach name="user" item="vo"> {$vo.userid}-{$vo.username}<br> </foreach>继续全小写,然后数据就能正常的出现在页面上了。
心得体会:遇到这样的问题最好找个朋友帮你看下,有时候可能很小的一个问题,你一个人很难再短时间内找出来,但是你的朋友才看
你的项目,就会一眼看出来。
0 0
- [8] Undefined index: UserId 错误 解决方案 thinkphp3.2
- ThinkPHP3.2隐藏index.php
- PHP Notice: Undefined index: ... 问题的解决方案
- Notice: Undefined index: ... 问题的解决方案
- Notice: Undefined index: ... 问题的解决方案
- PHP Notice: Undefined index: ... 问题的解决方案
- PHP 中 出现 Undefined index: ... ? 解决方案
- PHP Notice: Undefined index: ... 问题的解决方案
- PHP Notice: Undefined index: ... 问题的解决方案
- php upload Undefined index: file的解决方案
- Notice: Undefined index: ... 问题的解决方案
- PHP Notice: Undefined index: ... 问题的解决方案
- php Yii: 出现undefined offset 或者 undefined index解决方案
- Undefined index: submit in的错误处理
- Undefined index: submit in的错误处理
- vue的“$index” is undefined错误
- ThinkPhp3.2 无法加载模块:Index
- thinkphp3.2 实用的函数index
- 裸KMP 最简单无优化版本
- WPF中ListView在不滚动数据的情况下只能取到当前显示的数据,取不到滚动条以下的数据解决方法
- Xcode只能打开文件,无法打开工程
- 感人韩国电影推荐
- c#做端口转发程序支持正向连接和反向链接
- [8] Undefined index: UserId 错误 解决方案 thinkphp3.2
- VB MSHFlexGrid控件:CellAlignment 属性
- 《初入linux》--第二部分-系统结构与基本文件管理
- selenium之定位页面元素
- MockWebServer使用指南
- 读取ES_MULTILINE样式的EDIT的一部分Text
- 在自定义类中如何正确输出自定义类的属性值 objective-c的description
- Ubuntu启用root账户后,登录root账户时报错:读取/root/.profile时发现错误:mesg:ttyname failed:对设备不适当的ioctl操作 作为结果,会话不会被正确配置
- 【Android】真机调试新姿势:无线连接