Home > Backend Development > PHP Tutorial > 如何判断是不是pravite函数??

如何判断是不是pravite函数??

WBOY
Release: 2016-06-23 14:27:56
Original
1709 people have browsed it

比如CI框架,我们从URL上调用控制器中的pravite修饰的函数。它会跳到404_error界面。它是如何实现的呢?


回复讨论(解决方案)

私有的方法函数不可被外部访问,当发现请求的方法不存在时,就转向 404。这个并不难做到吧?

$p = new class;if(! method_exists($p)) {  header("HTTP/1.0 404 Not Found")  exit;}
Copy after login

无论是什么框架,能被你修改的都只是一个主控程序的回调(或是说插件)
你什么都不写,也并不会影响到框架的正常运行

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