从 PHP 运行 Python 脚本但它不起作用

问题描述

您好,我正在使用 PHP 来执行 python 脚本:

pdf.py

导入pdfkit pdfkit.from_url('https://www.google.co.in/','google.pdf');

data.PHP

ini_set('display_errors',1); error_reporting(E_ALL ^ E_DEPRECATED);

exec("python pdf.py");

我尝试使用带有上述数据的 PHP 执行 ython 文件,但脚本无法运行。

解决方法

也许试试 exec("python pdf.py",$response,$error_code); 看看是否在 $response$error_code 中返回任何有用的东西?