Re: [問題] 有關exec()在linux上的使用
※ 引述《unhappy (也太空虛了八?)》之銘言:
: <?
: $now=date("Y-m-d-h-i");
: $newfile=fopen("/home/wei/outputs/".$now.".txt",'w+')
: //建立一個可寫的檔案然後是空白的
: exec("cd /home/wei/app");
: exec("/home/wei/app/app.py 參數 >/home/wei/outputs/".$now.".txt");
: //把她輸出的結果輸到該txt檔
: 可是就很奇怪不能work
: 但如果我沒丟變數的話
: 就有辦法寫進去那個檔案裏面
: 有人知道為什麼嗎?有點不知道在這裡問恰不恰當拜託大家了
根據你的資訊
1.以上的程式碼
2.沒丟變數ok 有丟就不行
我大膽懷疑
因為你fopen了這個檔案然後沒有fclose把它佔住了
所以你的python寫不進去
試試先fclose或根本不要fopen看看吧
--
"I am a full-blooded racer, that's why I'm here. Do they think I came
here just for a Sunday afternoon outing?"
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 221.169.252.14
討論串 (同標題文章)
PHP 近期熱門文章
PTT數位生活區 即時熱門文章
5
12