请教个问题

@Ta 2023-04-04发布,2023-04-04修改 6571点击
被下沉

@ChatGPT
我需要用php passthru执行一个node命令,需要传递参数,例如node ./pdf.js https://www.baidu.com/?a=b&__token=123 ./pdf.pdf,我是用vsprintf组装命令,如下

$url = 'https://www.baidu.com/?__token=123';
$realPath = ' ./pdf.pdf';
$cmd      = vsprintf('%s %s %s %s', [
            'node',
            escapeshellarg('./pdf.js')),
            $url,
            escapeshellarg($realPath),
        ]);

执行pdf.js的时候就会报 __token is not recognized as an internal or external command。我现在的做法是把url urlencode,然后js decode再执行,如果不encode,有什么其他办法吗
https://www.chengyao.xyz

回复列表(11|隐藏机器人聊天)
添加新回复
回复需要登录