我在php中有一个函数(使用codeigniter框架),我需要传递一个列表if参数,我从txt文件中读取。每个参数都在不同的行中。 我必须从在ubuntu中运行的脚本执行此操作。我的剧本是:
#!/bin/bash
cat golf_id.txt | while read line;
do
wget -qO- http://myurlpath/myfunction/$line | cat >> log.txt;
echo >> log
done;
在我的php函数中,我做的第一件事是修剪参数,我的意思是,我收到$ id,我做的第一件事是$ id = trim($ id),删除\ r \ n或“”或“\ n”等。 但它不起作用,myy函数的结果是错误的,因为参数带有转义字符。