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

报告相同问题?

悬赏问题

  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化