TinyMVC始终显示“默认"控制器 [英] TinyMVC always shows 'default' controller

查看:122
本文介绍了TinyMVC始终显示“默认"控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在跟踪文档,直到最后,用smarty测试了一个html模板,然后将其剪切了.然后我发现控制器无法按预期工作-例如,我在myapp/conrollers'hello.php'中创建的任何名称都包含docs中描述的类. e.

I was following documentaion till the end, tested one html template with smarty and then cut it. Then I found out that controllers do not work as expected – whatever name I create in myapp/conrollers, 'hello.php' for example, that contains class described in docs, i. e.

class Hello_Controller extends TinyMVC_Controller
{
  function index()
  {
    echo "Hello World.";
  }
  function time()
  {
    echo "The time is now.";
  }
}

我无法显示.因此,文件名是控制器类名的前缀,在这里似乎一切正常,但是转到/index.php/hello将返回'default.php'中的内容.我什至尝试通过设置$config['default_controller']在myapp/configs/application.php中将默认控制器更改为"hello",但是该框架的行为就像始终与"default.php"一起使用时一样.屏幕或日志中没有错误(我检查了Web服务器和解释器的配置中的每个选项两次),我完全不知道该怎么办,我什至不能在其论坛上写因为要等待几天的行政审批".

I can’t show it. So the name of the file is a prefix for the controller class name, all seems to be ok here, but going to /index.php/hello returns what is in 'default.php'. I’ve even tried to change default controller to 'hello' in myapp/configs/application.php by setting $config['default_controller'], but the framework behaves like if it’s always work with the 'default.php'. There is no errors on screen or in logs (I checked twice every option in configs of my web server and interpreter), I totally don’t know what to do with that goddamn piece of crap, I can’t even write on its forum because waiting for ‘administration approval’ for several days.

推荐答案

我不得不深入研究框架以找到答案.当它检查控制器文件时,它使用file_exists()而不考虑包含路径.谷歌搜索"TinyMVC + file_exists"使我链接到该主题,其中写道他们已将其修复为SVN版本.

I had to dig inside of the framework to find an answer. And it is when it checks for a controller file it uses file_exists() which do not respect include path. Googling ‘TinyMVC+file_exists’ gave me link to that topic, where is written that they had fixed it in SVN version.

这篇关于TinyMVC始终显示“默认"控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆