thinkPHP,前端value值问题,大家看到帮帮忙,谢谢!

WBOY
Release: 2016-06-23 13:02:42
Original
956 people have browsed it

value=“”,我想要动态获取数据库的id,应该怎么写?大家帮帮忙,谢谢了!


回复讨论(解决方案)

你的写法本身没有问题,你想在模板里得到$id,得先把变量赋值到模板上(比如$id=123;$this->assign('id', $id))

控制器传值到view
$id = '1';
$this->assign('id',$id);


视图

楼上给出正确答案了,我就不多说了。

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!