PHP 类方法级联
我见过很多 php 脚本,您可以在其中级联类方法来生成特定的功能,例如在 codeigniter 中,当您加载要键入的视图时
<?php
class Posts extends Controller
{
function index() {
$this->load->view("BlaBla");
}
}
?>
我不完全确定这些是级联方法还是什么,但我不知道有足够的经验来破解 codeigniter 核心并弄清楚自己。
谁能告诉我如何做到这一点或指导我一些教程等
I have seen many php scripts in which you can cascade class method to produce a specific functionality for example as in codeigniter when you load a view you would type
<?php
class Posts extends Controller
{
function index() {
$this->load->view("BlaBla");
}
}
?>
I am not completely sure if these are cascaded methods or what butI don't have enough experience to hack the codeigniter core and figure out myself.
Can anyone tell me how to do this or guide me to some tutorial or so
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
每个方法都必须返回其类实例,例如:
或者您可以构建自己的缓存类来链接任何内容:
Every method must return its class instance, like:
or you can build your own cahining class to chain anything: