我有一个 php 文件调用脚本并打印输出,如下所示
$output=shell_exec('/usr/bin/python hello.py');
回显$输出;
它打印;
b'总计 16\ndrwx---rx 2 oae 用户 4096 Jul 31 14:21 .\ndrwxr-x--x+ 9 oae root 4096 Jul 26 13:59 ..\n-rwx---rx 1 oae 用户 90 8 月 3 日 11:22 hello.py\n-rwx---rx 1 oae 用户 225 8 月 3 日 11:22 index.php\n'
但应该是这样的;
总计16K
drwx---rx 2 oae 用户 4.0K 7 月 31 日 14:21 ./
drwxr-x--x+ 9 oae 根 4.0K 7 月 26 日 13:59 ../
-rwx---rx 1 oae 用户 90 Aug 3 11:22 hello.py*
-rwx---rx 1 oae 用户 225 Aug 3 11:22 index.php*
\n 字符不应显示。我该如何解决这个问题?
小智 5
这可以是工作
$output=shell_exec('/usr/bin/python hello.py');
echo "<pre>";
print_r($output);
echo "</pre>";
Run Code Online (Sandbox Code Playgroud)