繁体   English   中英

命令行中的PHP

[英]PHP from command line

我正在尝试使用此站点上的某些脚本

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

正如您在“用法”部分下所见,它为您提供了一些要放入命令行的参数

php extractYTVideoURLs.php yturls.txt mylist.txt

我已经下载了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

该错误似乎很明显。 C:\\Users\\extractYTVideoURLs.php第21行,代码在名为yturls.txt的文件上调用fopen() ,该文件找不到。 这个文件在哪里? 是否存在?

通常,最佳做法是使用完全限定的路径名​​引用文件。 请注意,您当前位于目录c:\\php因此,如果该文件不在当前工作目录中,则仅按名称引用就不会找到它。 您需要按文件所在位置引用文件。 可能是这样的:

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