dongqiu7365 2014-08-04 10:00
浏览 35
已采纳

无法使用Wamp使Route :: get方法在Laravel中工作

New to laravel and PHP programming. I managed to install laravel with wamp in Windows 7 according to this tutorial: http://www.wikihow.com/Install-Laravel-Framework-in-Windows. I moved all the contents of the public folder into C:/wamp/www/laravel. So, I can see the Laravel logo when I go to localhost:81/laravel/

Then, I was following this tutorial online (http://www.youtube.com/watch?v=U_0gNBN7Q7I) and somehow I was unable to view the html page when I go to localhost:81/laravel/mycontroller

app/controllers/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>

app/routes.php

Route::get('mycontroller', array('uses'=>'MyController@loadView'));

However, if I change the word 'mycontroller' to a '/', I can see the html page when I go to localhost:81/laravel. Anyone have any idea what I have done wrong here?

Route::get('/', array('uses'=>'MyController@loadView'));

Error Message

Not Found

The requested URL /laravel/mycontroller was not found on this server.
  • 写回答

1条回答 默认 最新

  • doulu1968 2014-08-05 02:08
    关注

    You probably forgot to activate the rewrite module for Apache.

    Click on the wamp icone in your taskbar -> Apache -> Apache modules -> rewrite_module (you will probably need to scroll down in the list of modules to find it)

    Or you can activate it manually in your file C:\wamp\bin\apache\ApacheX.X.X\conf\httpd.conf. Uncomment this line:

    LoadModule rewrite_module modules/mod_rewrite.so
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 comsol稳态求解器 找不到解,奇异矩阵有1个空方程返回的解不收敛。没有返回所有参数步长;pid控制
  • ¥15 怎么让wx群机器人发送音乐
  • ¥15 fesafe材料库问题
  • ¥35 beats蓝牙耳机怎么查看日志
  • ¥15 Fluent齿轮搅油
  • ¥15 八爪鱼爬数据为什么自己停了
  • ¥15 交替优化波束形成和ris反射角使保密速率最大化
  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功