簡體   English   中英

Phalcon路由器無法正常工作

[英]phalcon router not working

我嘗試將路由器與Phalcon配合使用。 這是在注冊“事件管理器”后立即將其包含在index.php中的方式:

$di->set('router', function(){
    require __DIR__.'/../app/config/routes.php';
    return $router;
});

這是routes.php的樣子:

<?php
$router = new Phalcon\Mvc\Router(false);

$router->add("/", array(
    'controller' => 'index',
    'action' => 'index'
));

$router->add("/topics", array(
    'controller' => 'wurst',
    'action' => 'index'
));

$router->handle();
return $router;

網站的反應就像路由器不存在一樣。 / topics和topic這樣說:

TopicsController handler class cannot be loaded

而且我也不能使用die(“ test”); 在route.php內部的功能。 什么都沒發生。
我也嘗試在沒有單獨文件的情況下激活它,但是結果是相同的:(

(示例網絡應用程序INVO被用作我的網站的起點)

$router->setUriSource(Router::URI_SOURCE_SERVER_REQUEST_URI); 將使用默認的$ _SERVER ['REQUEST_URI']

如果在訪問domain.com/index.php時索引/索引操作有效,請檢查您使用的是正確的uri源,如果使用nginx或php內置服務器,則路由和$ _GET ['_ uri ']使用哪個Phalcon處理尿液。

可以在有關uri來源的phalcon路由器文檔中找到更多相關信息-> http://docs.phalconphp.com/en/latest/reference/routing.html#uri-sources

現在看來可行:

Action 'route404' was not found on handler 'index'

問題是,我 “ set dispatcher function”(設置調度程序功能)中將用於設置路由器的功能放在index.php ..沒有看到右括號。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM