简体   繁体   English

命令行中的PHP

[英]PHP from command line

I am trying to use some of the scripts on this site 我正在尝试使用此站点上的某些脚本

http://www.tubekit.org/tools.php http://www.tubekit.org/tools.php

As you can see under the Usage section it gives you some arguments to put into the command line 正如您在“用法”部分下所见,它为您提供了一些要放入命令行的参数

php extractYTVideoURLs.php yturls.txt mylist.txt

I have downloaded the extract php file and made the 2 text files yet I only get this answer in the command line. 我已经下载了php文件解压缩并制作了2个文本文件,但我只能在命令行中得到此答案。

c:\php>php C:/Users/extractYTVideoURLs.php yturls.txt my
list.txt

Warning: fopen(yturls.txt): failed to open stream: No such file or directory in
C:\Users\extractYTVideoURLs.php on line 21

Warning: fgets() expects parameter 1 to be resource, boolean given in C:\Users\extractYTVideoURLs.php on line 24

Warning: fclose() expects parameter 1 to be resource, boolean given in C:\Users\
extractYTVideoURLs.php on line 52

The error seems pretty clear. 该错误似乎很明显。 On line 21 of C:\\Users\\extractYTVideoURLs.php the code calls fopen() on a file called yturls.txt which it can't find. C:\\Users\\extractYTVideoURLs.php第21行,代码在名为yturls.txt的文件上调用fopen() ,该文件找不到。 Where is this file? 这个文件在哪里? Does it exist at all? 是否存在?

It's generally best practice to reference a file with a fully-qualified path name. 通常,最佳做法是使用完全限定的路径名​​引用文件。 Note that you're currently in the directory c:\\php so if that file isn't in the current working directory then just referencing it by name isn't going to find it. 请注意,您当前位于目录c:\\php因此,如果该文件不在当前工作目录中,则仅按名称引用就不会找到它。 You'll need to reference the file by where it's located. 您需要按文件所在位置引用文件。 Potentially something like this: 可能是这样的:

php C:/Users/extractYTVideoURLs.php C:/Path/to/yturls.txt C:/Path/to/mylist.txt

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM