0
剛開始使用Phalcon,發現一些奇怪的錯誤。重定向到錯誤路徑Phalcon
這是我在public/index.php
<?php
use Phalcon\Loader;
use Phalcon\Mvc\View;
use Phalcon\Mvc\Application;
use Phalcon\Di\FactoryDefault;
use Phalcon\Mvc\Url as UrlProvider;
use Phalcon\Db\Adapter\Pdo\Mysql as DbAdapter;
// Register an autoloader
$loader = new Loader();
$loader->registerDirs(
[
"../app/controllers/",
"../app/models/",
]
);
$loader->register();
// Create a DI
$di = new FactoryDefault();
// Setup the view component
$di->set(
"view",
function() {
$view = new View();
$view->setViewsDir("../app/views/");
return $view;
}
);
// Setup a base URI so that all generated URIs include the "bot" folder
$di->set(
'url',
function() {
$url = new \Phalcon\Mvc\Url();
$url->setBaseUri('/bot/');
return $url;
}
);
$application = new Application($di);
try {
// Handle the request
$response = $application->handle();
$response->send();
} catch (\Exception $e) {
echo "Exception: ", $e->getMessage();
}
代碼根據這一點,我的路徑應該是localhost/bot/
。
所以,當我瀏覽到localhost/bot/public/
,我得到所需的輸出。
爲什麼它不像網站上給出的方式?