我们在HTML页面中有几个字段,并且正在使用php写入一个文件。在linux中使用php创建一个txt文件
该文件有数据,但是,运行一个bash脚本,该文件带有一个.txt作为扩展名不起作用。
当文件被打开并手动重新保存时,bash脚本将正常工作!
我试过改变文件的权限,但bash脚本仍然没有使用这个文件。任何帮助,这是非常感谢。
php脚本:
$name = "test.txt";
$handle = fopen($name, "w");
fwrite($handle, "my message");
fclose($handle);
bash脚本:
INPUT="$1"
OLDIFS=$IFS
IFS=,
[ ! -f $INPUT ] && { echo "$INPUT file not found"; exit 99; }
while read message number ; do
echo $message # or whaterver you want to do with the $line variable
#j=$[$(line)]
echo $number
echo "$message" | gnokii --sendsms $number --smsc $SMSC
done < $INPUT
IFS=$OLDIFS
你可以发布什么bash脚本试图做什么?另外,澄清你的意思是“只是扩展名被重命名”? –
你可以试试:'$ name =“/tmp/test.txt”;' – anubhava
我回滚你的问题,因为如果你将'unlink'改成'fclose',这是一个完全不同的问题。 – Mike