2014-12-22 108 views
-3

我有我將使用這個PHP代碼在Linux上運行解析錯誤:語法錯誤,意外'(T_CONSTANT_ENCAPSED_STRING)

<?php 

include 'theme.php'; 
ceklogin(); 
css(); 

if($_POST['wget-send']) 
{ 
    $dir=$_POST['dir']; 
    $link=$_POST['link']; 
    exec('cd '.$dir,$out); 
    exec('echo '.$link' > /tmp/wget-download-link.txt',$out); 
    exec('wget -i /tmp/wget-download-link.txt -o /tmp/wget.log -c -t 100 -w 10',$out); 
    echo $out[2]; 
    exit(); 
} 

echo "<br><br><form action=\"".$PHP_SELF."\" method=\"post\">"; 
echo "Download directory :<br><input type=\"text\" name=\"dir\" size=\"15\" value=\"/mnt/usb/\"/><br>"; 
echo '<br>Download link :<br>'; 
echo "<textarea name=\"link\" rows=\"4\" cols=\"35\"></textarea><br><br>"; 
echo '<input type="submit" name="wget-send" value="Send" />'; 
echo "</form></div>"; 

foot(); 
echo ' 
</div> 
</body> 
</div> 
</html>'; 

?> 

wget的當我嘗試運行它給了我錯誤的PHP:

Parse error: syntax error, unexpected '' > /tmp/wget-download-link.tx' (T_CONSTANT_ENCAPSED_STRING) in /www/wget.php on line 10 

我哪裏出錯了?

+1

' '$ link'' - >''。$ link.'' – kero

回答

0

缺少.$link後,在這條線:

exec('echo '.$link.' > /tmp/wget-download-link.txt',$out); 
0

缺少在這條線一.

exec('echo '.$link.' > /tmp/wget-download-link.txt',$out); 
0

這個網站是不是你的基本語法調試錯誤,但是在這裏你去無論如何。

exec('echo '.$link' > /tmp/wget-download-link.txt',$out); 

你缺少.$link

應該

exec('echo '.$link.' > /tmp/wget-download-link.txt',$out); 
相關問題