[英]Phalcon project index cannot find the controller, and server error is 404 not found
I started this Phalcon project by following the tutorial , but Im having problem with controller. 我按照教程开始了这个Phalcon项目,但是我在控制器方面遇到了问题。 for example, I set up the exception in Index.php such as
例如,我在Index.php中设置了异常,例如
$application = new Application($di);
try {
// Handle the request
$response = $application->handle();
$response->send();
} catch (\Exception $e) {
echo 'Exception: ', $e->getMessage();
}
so I am implementing this sign up function as following, in file signup/index.phtml 所以我要在文件signup / index.phtml中实现以下注册功能
<?php echo $this->tag->form("signup/register"); ?>
<p>
<label for="name">Name</label>
<?php echo $this->tag->textField("name"); ?>
</p>
<p>
<label for="email">E-Mail</label>
<?php echo $this->tag->textField("email"); ?>
</p>
<p>
<?php echo $this->tag->submitButton("Register"); ?>
</p>
</form>
and in the root index.php, I have echo $this->tag->linkTo( 'signup', 'Sign Up Here!' ); 在根index.php中,我已回显$ this-> tag-> linkTo('signup','Sign Up Here!');
but when I click on "Sign Up Here!" 但是当我点击“在这里注册!” from web page I got the error says "Not Found The requested URL /signup was not found on this server."
从网页上,我收到错误消息“找不到此服务器上未找到请求的URL /注册”。
it is not even showing the exception I set in the beginning, I do know what is the problem why is this happening, I appreciate any help. 它甚至都没有显示我一开始设置的异常,我确实知道问题出在哪里,为什么会出现这种情况,感谢您的帮助。
then I tried to create a project by using Phalcon Developer tools with command phalcon create-project new_project I got error Segmentation fault: 11, does anyone know what is this mean? 然后我尝试通过将Phalcon Developer工具与命令phalcon create-project new_project一起使用来创建项目。我遇到错误分段错误:11,有人知道这是什么意思吗?
Thank you! 谢谢!
What is your address bar showing you after you clicked it? 单击后,您的地址栏显示什么?
From my experience, it usually has something to do with your base uri... 根据我的经验,它通常与您的基本尿液有关。
If you followed the tutorial strictly, make sure your base URI is set-up like this... 如果您严格按照本教程进行操作,请确保您的基本URI设置如下:
$di->set(
'url',
function () {
$url = new UrlProvider();
$url->setBaseUri('/');
return $url;
}
); );
However, if you built your app using the Phalcon Devtools, go to app/config/config.php
and refactor your base uri section to 但是,如果您使用Phalcon Devtools构建了应用程序,请转到
app/config/config.php
并将您的基本uri部分重构为
'baseUri' => '/'
For the segmentation issue, make sure that: 1) You are using PHP 7.2 or less. 对于细分问题,请确保:1)您使用的是PHP 7.2或更低版本。 PHP 7.3 support is still in the works... 2) You are using the latest version of Phalcon Devtools.
PHP 7.3支持仍在进行中... 2)您正在使用最新版本的Phalcon Devtools。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.