我想要一个PHP脚本来运行以下代码: 感谢您的阅读(或帮助)
PHP可以运行简单的Print('hello world')
.py文件,但不会运行以下代码:
#!/usr/bin/env python
from pytube import YouTube
import sys
print('....Video Downloading....')
YouTube(sys.argv[1]).streams.first().download('videos')
print('DONE!')
PHP 命令是
$URL = $_GET['url'];
$fi = new FilesystemIterator('videos', FilesystemIterator::SKIP_DOTS);
printf("<br>There were %d Files", iterator_count($fi));
echo "<br><br>DEBUG:<br>";
$command = "/usr/bin/python3.6 main.py $URL";
//$command = 'whoami';
exec($command, $out, $status);
print_r($out);
echo "....".$status;
echo "<br>end DEBUG<br><br>";