如何在 Eclipse 中启动 Laravel 项目

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22652037/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 09:15:31  来源:igfitidea点击:

How to start a Laravel project in eclipse

phpeclipselaravel

提问by Peter Hon

I have installed Laravel in windows 7 apache 2.4. I installed it with the following steps:

我已经在 windows 7 apache 2.4 中安装了 Laravel。我按照以下步骤安装了它:

  1. Create folder named new_project under apache24/htdocs(which is also eclipse workspace folder);

  2. Then I insalled Laravel by command : composer create-project laravel/laravel --prefer-dist

  3. The laravel is installed in C:\apache24\htdocs\new_project\laravel\

  4. I have also download a laravel_helper_function.php and include it in Eclipse PHP include path. It make the Laravel namespace visible.
  1. apache24/htdocs(也是eclipse工作区文件夹)下创建名为new_project的文件夹;

  2. 然后我通过命令安装了 Laravel: composer create-project laravel/laravel --prefer-dist

  3. Laravel 安装在 C:\apache24\htdocs\new_project\laravel\

  4. 我还下载了 laravel_helper_function.php 并将其包含在 Eclipse PHP 包含路径中。它使 Laravel 命名空间可见。

Then I tried a simple program, and tried to debug it.

然后我尝试了一个简单的程序,并尝试调试它。

<?php

  App::isLocal();
  phpinfo();
  echo("hello");
  echo("hello");

?>

I set a breakpoint in

我在里面设置了一个断点

 App::isLocal();

However, the line does not executed and stop responding. I doubt that although I have the helper function that makes me to use laravel namespace. However, eclipse seems do not know where to call the Laravel function? What step do I missed? I am new to Laravel. And I have search the internet. Seems no answer.

但是,该行不会执行并停止响应。我怀疑虽然我有帮助函数让我使用 laravel 命名空间。不过eclipse好像不知道从哪里调用Laravel函数?我错过了什么步骤?我是 Laravel 的新手。我已经在互联网上搜索过。似乎没有答案。

Please help. Thanks.

请帮忙。谢谢。

回答by Peter Hon

I found the solution. Just include these two file in laravel installed folder to index.php, then I can debug it. I found it after I read the documentation in Laravel website carefully again.

我找到了解决方案。只需将 laravel 安装文件夹中的这两个文件包含到 index.php 中,然后我就可以调试它。仔细阅读了 Laravel 网站上的文档后,我找到了它。

require __DIR__.'/../bootstrap/autoload.php';

$app = require_once __DIR__.'/../bootstrap/start.php';

then the app can run.

然后应用程序可以运行。

$app->run();

Thanks so much

非常感谢