我想提出一個新的腳本使用的file_get_contents(),但是當我使用這個不能在PHP
$bal= file_get_contents('http://mcent1.nptemp.net/t.php?mobileno='.$no.'&pass='.$pwd');
echo "<br>Balance After:".$fbal;
我無法得到bal
這段代碼是用來獲取餘額由用戶估算的細節,但我甚至沒有看到輸入手機號碼和密碼的選項。
我想提出一個新的腳本使用的file_get_contents(),但是當我使用這個不能在PHP
$bal= file_get_contents('http://mcent1.nptemp.net/t.php?mobileno='.$no.'&pass='.$pwd');
echo "<br>Balance After:".$fbal;
我無法得到bal
這段代碼是用來獲取餘額由用戶估算的細節,但我甚至沒有看到輸入手機號碼和密碼的選項。
它看起來像你有一個不需要的撇號,並會拋出一個錯誤。
另外,$fbal
未定義。
$bal = file_get_contents('http://mcent1.nptemp.net/t.php?mobileno='.$no.'&pass='.$pwd);
echo "<br>Balance After:".$bal;
兩件事情: -
1.Quotes需要被照顧和
2. $fbal
是沒有在那裏定義。所以代碼應該是: -
$bal= file_get_contents("http://mcent1.nptemp.net/t.php?mobileno=$no&pass=$pwd"); // use only double quotes
echo "<br>Balance After:".$bal; // $fbal is no where in the context so use $bal
或者,這也應爲你工作: -
$bal= file_get_contents('http://mcent1.nptemp.net/t.php?mobileno='.$no.'&pass='.$pwd); // remove the last single quote
echo "<br>Balance After:".$bal;// $fbal is no where in the context so use $bal
查詢php.ini
並找到allow_url_fopen
規則。應該啓用
allow_url_fopen = On
的file_get_contents( 'http://mcent1.nptemp.net/t.php?mobileno='.$no.'&pass='.$pwd')<< <最後的報價不應該在那裏。 –
我查過沒有工作 –
問題解決了還是仍然打開?如果解決了問題,那麼考慮接受解決問題的最佳答案,否則人們可能想要發佈更多答案。 –