laravel 如何找到 /path/to/artisan ?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/40308963/
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 14:40:12  来源:igfitidea点击:

How do find /path/to/artisan ?

phplaravellaravel-5artisan

提问by cyber8200

Trying to Scheduling Artisan Commands

尝试调度 Artisan 命令

https://laravel.com/docs/5.0/artisan

https://laravel.com/docs/5.0/artisan

* * * * * php /path/to/artisan schedule:run 1>> /dev/null 2>&1

Can someone please show me how do I know the /path/to/artisan?

有人可以告诉我我怎么知道/path/to/artisan吗?

采纳答案by Alexey Mezenin

artisanis in your Laravel project root. So, if your project path looks like /home/laravel-proj/use this:

artisan位于您的 Laravel 项目根目录中。因此,如果您的项目路径如下所示,请/home/laravel-proj/使用:

* * * * * php /home/laravel-proj/artisan schedule:run 1>> /dev/null 2>&1

回答by Md Rashedul Hoque Bhuiyan

extending the answer given by @Alexy Mezenin , to get current working directory on ubuntu use pwdcommand.

扩展@Alexy Mezenin 给出的答案,以获取 ubuntu 上的当前工作目录,使用pwd命令。

For windows user it may be cd

对于 Windows 用户,它可能是cd

So if you have a project in desktop/blog. go to the blogdirectory and run pwdcommand and you'll get the path to artisan which is /home/user/Desktop/blog

因此,如果您在desktop/blog 中有一个项目。转到blog目录并运行pwd命令,您将获得 artisan 的路径,即/home/user/Desktop/blog

Then you'll use this:

然后你会使用这个:

* * * * * php /home/user/Desktop/blog/artisan schedule:run 1>> /dev/null 2>&1

回答by aynber

Artisan is located in your project directory. For instance, my crontab shows something like this:

Artisan 位于您的项目目录中。例如,我的 crontab 显示如下:

 *  *  *  *  *  /usr/bin/php /var/www/projectfolder/artisan command

回答by user2884476

On linux systems: Using terminal > Go to project folder-> run pwd.The path you should get is the absolute path to your project.

在linux系统上:使用终端>转到项目文件夹->运行pwd。您应该获得的路径是项目的绝对路径。

On Windows, I think you need to run cd

在 Windows 上,我认为你需要运行 cd