'@'.realpath($path).";filename=".$filename); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true ); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $return_data = curl_exec($ch); curl_close($ch); $decode = json_decode($return_data); echo $decode->original_pic; } if ($_POST) { $url = 'https://127.0.0.1/img.php'; $tmpname = $_FILES['fname']['name']; $tmpfile = $_FILES['fname']['tmp_name']; upload_file($url,$tmpname,$tmpfile); exit; } echo '';?>
代碼如上,為什麼刪掉就無法執行post?
回複內容:
'@'.realpath($path).";filename=".$filename); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true ); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $return_data = curl_exec($ch); curl_close($ch); $decode = json_decode($return_data); echo $decode->original_pic; } if ($_POST) { $url = 'https://127.0.0.1/img.php'; $tmpname = $_FILES['fname']['name']; $tmpfile = $_FILES['fname']['tmp_name']; upload_file($url,$tmpname,$tmpfile); exit; } echo '';?>
代碼如上,為什麼刪掉就無法執行post?
有沒有什麼錯誤資訊啊!貼出來看看
。。。應該有報錯的啊,執行是空返回嗎?那隻能打斷點看看那一步出問題
上傳的檔案資訊應該是會存在放 $_FILES 而不會存在放$_POST裡面 然後你的post裡面不就沒東西了提前打出$_POST
沒有找到文檔說明 只是實驗了下 可以把submit設定一個name