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
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥80 部署运行web自动化项目
  • ¥15 腾讯云如何建立同一个项目中物模型之间的联系
  • ¥30 VMware 云桌面水印如何添加
  • ¥15 用ns3仿真出5G核心网网元
  • ¥15 matlab答疑 关于海上风电的爬坡事件检测
  • ¥88 python部署量化回测异常问题
  • ¥30 酬劳2w元求合作写文章
  • ¥15 在现有系统基础上增加功能
  • ¥15 远程桌面文档内容复制粘贴,格式会变化
  • ¥15 这种微信登录授权 谁可以做啊