php: 以“*”作为参数调用 python 脚本

php: call python script with "*" as argument

我正在尝试通过 php 调用 python 脚本,但其中一个参数被作为参考传递?我想传递 "*" 但是当它到达 python 脚本时,它变成 "attempt.php" 这是我的 php 文件名。我怎样才能解决这个问题以仅通过 "*" 这是我发送的代码(有 3 个变量,其中之一是 "*"

$python = `python test.py $a $b $c`;

*是shell中的通配符,需要转义。使用 escapeshellarg.

$aesc = escapeshellarg($a);
$besc = escapeshellarg($b);
$cesc = escapeshellarg($c);
$python = `python test.py $aesc $besc $cesc`;