laravel和PHP编程的新手。根据本教程,我设法在Windows 7中安装带有wamp的laravel:http://www.wikihow.com/Install-Laravel-Framework-in-Windows。我将公用文件夹的所有内容移动到C:/ wamp / www / laravel。所以,当我去localhost时,我可以看到Laravel标志:81 / laravel /
然后,我在线学习本教程(http://www.youtube.com/watch?v=U_0gNBN7Q7I),当我去localhost时,我无法查看html页面:81 / laravel / mycontroller
应用程序/控制器/ MyController.php
<?php
class MyController extends BaseController
{
public function loadView()
{
return View::make('myview');
}
}
app / views / myview.php
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Testing</title>
</head>
<body>
<h1></h1>
<p>It worked!</p>
</body>
</html>
应用程序/ routes.php文件
Route::get('mycontroller', array('uses'=>'MyController@loadView'));
但是,如果我更改“我的控制器”这个词。到了&#39; /&#39;,当我去localhost:81 / laravel时,我可以看到html页面。任何人都知道我在这里做错了什么?
Route::get('/', array('uses'=>'MyController@loadView'));
错误消息
Not Found
The requested URL /laravel/mycontroller was not found on this server.
答案 0 :(得分:2)
您可能忘记激活Apache的重写模块。
点击任务栏中的wamp icone - &gt; Apache - &gt; Apache模块 - &gt; rewrite_module(您可能需要在模块列表中向下滚动才能找到它)
或您可以在文件C:\ wamp \ bin \ apache \ ApacheX.X.X \ conf \ httpd.conf中手动激活它。取消注释这一行:
LoadModule rewrite_module modules/mod_rewrite.so