设置值显示信息
我有一段代码,我无法弄清楚它实际上是如何工作的。 它的流程是这样的,看起来很简单
- 获取要显示的信息 例如
$info
- 使用
$this->set('columnname', $info);
显示信息
是cakephp 中内置了那个 set 函数? columnname
也可以是页面的内容/类型。此 set
将在页面中显示信息。我需要查看的页面源在哪里?例如,它可能存储在某个视图中的某个位置,该视图具有类似 的内容,然后它可能只需要获取 id 并替换跨度内的内容。
I have a piece of code I can't figure out how it actually works.
Its flow is like this, looks very easy
- Get information to display for example
$info
- Display information using
$this->set('columnname', $info);
Is that set function built-in in cakephp? columnname
can also be page's content/type. this set
will display info in the page. Where is that page source I need to see? For example perhaps it is stored somewhere in some view that has something like <span id=x></span>
it then may only need to get the id and replace something inside the span.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的 set 是内置在 cakephp 中的。
您从控制器设置变量以将其传递给视图,就像在控制器中一样
然后在视图中您可以访问它:
您的意思是这样的吗?希望有帮助
Yes set is built-in in cakephp.
You set variables from controller to pass it to view, like in your controller
Then in view you can access it as:
Did you mean something like that. Hope it helps