简体   繁体   中英

PHP from command line

I am trying to use some of the scripts on this site

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.

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. 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. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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