<select?id="news_type"?>新聞類型
?????<option?value="1">推薦</option>
?????<option?value="2">科技</option>
?????<option?value="3">文學</option>
?????<option?value="4">圖片</option>
????</select>
????<label?for="news_title">新聞標題</label>
????<input?type="text"?id="news_title"?name="news_title"?/>
????<label?for="news_content">新聞內容</label>
????<textarea?id="news_content"?name="news_content"?></textarea>
????<label?for="news_source">新聞來源</label>
????<input?type="text"?id="news_source"?name="news_source"?/>
????<label?for="news_image">新聞圖片</label>
????<input?type="text"?id="news_image"?name="news_image"?/>
????<label?for="publish_time">發布時間</label>
????<input?type="text"?id="publish_time"?name="publish_time"?/>
<input?type="button"?value="添加"?id="add"?/>$(function(){
$("#add").on("click",function(){
$.ajax({
type:"POST",
url:"add_handler.php",
dataType:"json",
data:{
type:$("#news_type").val(),
title:$("#news_title").val(),
content:$("#news_content").val(),
source:$("#news_source").val(),
image:$("#news_image").val()
},
success:function(data){
if(data){
console.log(data);
}else{
alert("error");
}
},
error:function(jqXHR){
alert("發生錯誤:"+jqXHR.status);
}
});
});
});<?php
//require_once("../connect.php");
//添加
$type?=?$_POST['type'];
$title?=?$_POST['title'];
$content?=?$_POST['content'];
$source?=?$_POST['source'];
$image?=?$_POST['image'];
$time?=?time();
//echo?$type;
?>請問我的代碼寫錯了,為什么在我本地后臺PHP取不到數據。前臺已經成功發送數據后臺一直報錯把代碼發給別人的環境看過,別人能取到數據。請問是我本地的環境問題嗎?裝的是wamp集成開發包
后臺PHP取不到數據,求高手解答
tyc1
2016-07-19 17:26:17