Php 如何替换shell_exec return中的空白?
我将php函数shell_exec与ls命令一起使用:Php 如何替换shell_exec return中的空白?,php,html,linux,bash,Php,Html,Linux,Bash,我将php函数shell_exec与ls命令一起使用: shell_exec('ls'); 报税表为: index.php index.php~ ajaxF.php ajaxF.php~ ajaxL.php ajaxL.php~ ajax.php 我注意到每个文件之间都有一个空格,我试图更改它,但失败了(“a”它只是一个随机字符,实际上我想添加一些html): preg_replace(“//”、“A”、$output); preg_replace(“//”、“A”、$output); pr
shell_exec('ls');
报税表为:
index.php index.php~ ajaxF.php ajaxF.php~ ajaxL.php ajaxL.php~ ajax.php
我注意到每个文件之间都有一个空格,我试图更改它,但失败了(“a”它只是一个随机字符,实际上我想添加一些html):
preg_replace(“//”、“A”、$output);
preg_replace(“/
/”、“A”、$output);
preg_replace(“/\n/”、“A”、$output);
如何用任何其他字符替换此空白?
这意味着为每一行添加html数据
可以拆分数组中的每一行吗
顺便说一下,我正在使用ubuntu
谢谢 为什么不使用glob('*')
,它将返回当前目录中的文件数组?然后,您可以使用infrade()并插入所需的任何分隔符char/文本
ref:为什么不使用glob('*')
,它将返回当前目录中的文件数组?然后,您可以使用infrade()并插入所需的任何分隔符char/文本
参考:谢谢!比我想象的要好!谢谢比我想象的要好!
preg_replace('/ /', "A", $output);
preg_replace('/<br>/', "A", $output);
preg_replace('/\n/', "A", $output);