In there 存在一个简单的PHP MVC示例。问题是,这个例子只是工作时,这个关于简单的PHP MVC示例
$action = $_GET['action'];
if(function_exists($action) && !substr($action,0,1)=="_"){
$action();
}else{
echo "<h1>404 Page Not Found</h1><p>The page you requested could not be found</p>";
}
改为:
$action = $_GET['action'];
if(function_exists($action) || !substr($action,0,1)=="_"){
$action();
}else{
echo "<h1>404 Page Not Found</h1><p>The page you requested could not be found</p>";
}
& &改为||。或完全!substr($ action,0,1)==“_”删除。这条线是不允许运行的$ action?
=======================
编辑:问题是,路由器不& &工作!
你为什么要这样? _通常是跟踪私有函数,这些函数只能在其他类函数中使用。 – Jason
为什么这个标签为“mvc”?问题应该是“substr()如何工作?” –