我有json值存储在一个隐藏的字段,我想解码json在PHP中的$_POST。该值存储在名为alldata的隐藏字段中,我正在$_POST['alldata']中检索,我正在尝试这个$_POST['alldata']变量上名为json_decode的php函数。请告诉我如何解码PHP中的json。请帮帮我。提前感谢。
HTML
<input type="hidden" name="alldata" id="alldata" value="{"email2":"nitinjohnson316@gmail.com","class_rate":"10.000","admin_rate":"20.000","late_charge":"10.000","final_data":[{"pre_assignment_id":"4","user_id":"2","session_id":"52","school":"Admin","day_of_week":"","start_date":"1970-01-01","end_date":"1970-01-01","expense_allowance_value":"0","hours_allowed":"5","event_id":"999999","event_title":"Admin","event_description":null,"event_category":"Admin","event_status":"Active","event_status_num":"5","event_timecard":"A","session_dayofweek":"","session_start_date":"0000-00-00","session_end_date":"0000-00-00","refresh_tmstp":"2015-10-10 18:02:35"},{"pre_assignment_id":"3","user_id":"2","session_id":"16","school":"Bethany Elementary","day_of_week":"Wed","start_date":"2015-09-09","end_date":"2015-12-12","expense_allowance_value":"5","hours_allowed":"0","event_id":"3481","event_title":"Fall 2015 - Bethany Elementary Chess Program - Plano ISD","event_description":null,"event_category":"Bethany Elementary","event_status":"Ongoing","event_status_num":"3","event_timecard":"C","session_dayofweek":"Wed","session_start_date":"2015-09-09","session_end_date":"2015-12-09","refresh_tmstp":"2015-10-10 18:02:35"},{"pre_assignment_id":"2","user_id":"2","session_id":"15","school":"Ashley Elementary","day_of_week":"Mon","start_date":"2015-09-14","end_date":"2015-12-12","expense_allowance_value":"15","hours_allowed":"0","event_id":"3511","event_title":"Fall 2015 - Ashley Elementary Chess Program - Frisco ISD","event_description":null,"event_category":"Ashley Elementary","event_status":"Ongoing","event_status_num":"3","event_timecard":"C","session_dayofweek":"Mon","session_start_date":"2015-09-14","session_end_date":"2015-12-07","refresh_tmstp":"2015-10-10 18:02:35"},{"pre_assignment_id":"1","user_id":"2","session_id":"14","school":"Anderson Elementary","day_of_week":"Mon","start_date":"2015-09-21","end_date":"2015-12-12","expense_allowance_value":"5","hours_allowed":"0","event_id":"3613","event_title":"Fall 2015 - Anderson Elementary Chess Program - Frisco ISD","event_description":null,"event_category":"Anderson Elementary","event_status":"Active Hidden","event_status_num":"2","event_timecard":"C","session_dayofweek":"Mon","session_start_date":"2015-09-21","session_end_date":"2015-12-07","refresh_tmstp":"2015-10-10 18:02:35"}]}">
Javascript
jQuery("#txtweek").change(function(){
if(jQuery("select[name='txtuser'] option:selected").text()=='--select--'){
alert("Please select a user first to proceed");
return false;
} else {
jQuery.ajax({
url:ajaxurl,
type:'post',
data:{action:'timecardapp_manage_timecard_stepone',user_id: jQuery("#txtuser").val()},
success: function(response){
var data=JSON.parse(response);
// i am adding json value to hidden field from here
jQuery("#alldata").val(JSON.stringify(data));
var currentweek = jQuery("#txtweek option:selected").text();
var days_date = new Array();
function pad(str) {
return ("0"+str).slice(-2);
}
function getNextDay(str) {
var parts = str.split("-");
var mon_day = new Date(parts[2], parts[0] - 1, parseInt(parts[1], 10) + 0, 12, 0, 0, 0);
var tue_day = new Date(parts[2], parts[0] - 1, parseInt(parts[1], 10) + 1, 12, 0, 0, 0);
var wed_day = new Date(parts[2], parts[0] - 1, parseInt(parts[1], 10) + 2, 12, 0, 0, 0);
var thu_day = new Date(parts[2], parts[0] - 1, parseInt(parts[1], 10) + 3, 12, 0, 0, 0);
var fri_day = new Date(parts[2], parts[0] - 1, parseInt(parts[1], 10) + 4, 12, 0, 0, 0);
days_date[0] = ""+pad(mon_day.getMonth()+1)+"-"+ pad(mon_day.getDate())+"-"+mon_day.getFullYear();
days_date[1] = ""+pad(tue_day.getMonth()+1)+"-"+ pad(tue_day.getDate())+"-"+tue_day.getFullYear();
days_date[2] = ""+pad(wed_day.getMonth()+1)+"-"+ pad(wed_day.getDate())+"-"+wed_day.getFullYear();
days_date[3] = ""+pad(thu_day.getMonth()+1)+"-"+ pad(thu_day.getDate())+"-"+thu_day.getFullYear();
days_date[4] = ""+pad(fri_day.getMonth()+1)+"-"+ pad(fri_day.getDate())+"-"+fri_day.getFullYear();
}
var currentweek = jQuery("#txtweek option:selected").text(), // no values available
next_day = new Date(); // or some other default
if (currentweek && currentweek.indexOf("--") == -1) { // not the first
next_day=getNextDay(currentweek);
}
var trHTML = '';
var number_of_classes = 0;
var totalexpense = 0;
var totaladminhours = 0;
jQuery.each(data.final_data, function (i, item) {
if(item.event_title == 'Admin'){
//Monday
trHTML += '<tr>';
trHTML += '<td>'+item.event_title+'</td>';
trHTML += '<td>Mon</td>';
trHTML += '<td>'+days_date[0]+'</td>';
trHTML += '<td>Y</td>';
trHTML += '<td>'+item.start_date+'</td>';
trHTML += '<td>'+item.end_date+'</td>';
trHTML += '<td> </td>';
trHTML += '<td> </td>';
trHTML += '<td>'+item.expense_allowance_value+'</td>';
trHTML += '<td>'+item.hours_allowed+'</td>';
trHTML += '</tr>';
//Tuesday
trHTML += '<tr>';
trHTML += '<td>'+item.event_title+'</td>';
trHTML += '<td>Tue</td>';
trHTML += '<td>'+days_date[1]+'</td>';
trHTML += '<td>Y</td>';
trHTML += '<td>'+item.start_date+'</td>';
trHTML += '<td>'+item.end_date+'</td>';
trHTML += '<td> </td>';
trHTML += '<td> </td>';
trHTML += '<td>'+item.expense_allowance_value+'</td>';
trHTML += '<td>'+item.hours_allowed+'</td>';
trHTML += '</tr>';
//Wednesday
trHTML += '<tr>';
trHTML += '<td>'+item.event_title+'</td>';
trHTML += '<td>Wed</td>';
trHTML += '<td>'+days_date[2]+'</td>';
trHTML += '<td>Y</td>';
trHTML += '<td>'+item.start_date+'</td>';
trHTML += '<td>'+item.end_date+'</td>';
trHTML += '<td> </td>';
trHTML += '<td> </td>';
trHTML += '<td>'+item.expense_allowance_value+'</td>';
trHTML += '<td>'+item.hours_allowed+'</td>';
trHTML += '</tr>';
//Thursday
trHTML += '<tr>';
trHTML += '<td>'+item.event_title+'</td>';
trHTML += '<td>Thu</td>';
trHTML += '<td>'+days_date[3]+'</td>';
trHTML += '<td>Y</td>';
trHTML += '<td>'+item.start_date+'</td>';
trHTML += '<td>'+item.end_date+'</td>';
trHTML += '<td> </td>';
trHTML += '<td> </td>';
trHTML += '<td>'+item.expense_allowance_value+'</td>';
trHTML += '<td>'+item.hours_allowed+'</td>';
trHTML += '</tr>';
//Friday
trHTML += '<tr>';
trHTML += '<td>'+item.event_title+'</td>';
trHTML += '<td>Fri</td>';
trHTML += '<td>'+days_date[4]+'</td>';
trHTML += '<td>Y</td>';
trHTML += '<td>'+item.start_date+'</td>';
trHTML += '<td>'+item.end_date+'</td>';
trHTML += '<td> </td>';
trHTML += '<td> </td>';
trHTML += '<td>'+item.expense_allowance_value+'</td>';
trHTML += '<td>'+item.hours_allowed+'</td>';
trHTML += '</tr>';
} else {
trHTML += '<tr>';
trHTML += '<td>'+item.event_title+'</td>';
trHTML += '<td>'+item.day_of_week+'</td>';
if(item.day_of_week=='Mon'){
trHTML += '<td>'+days_date[0]+'</td>';
}
if(item.day_of_week=='Tue'){
trHTML += '<td>'+days_date[1]+'</td>';
}
if(item.day_of_week=='Wed'){
trHTML += '<td>'+days_date[2]+'</td>';
}
if(item.day_of_week=='Thu'){
trHTML += '<td>'+days_date[3]+'</td>';
}
if(item.day_of_week=='Fri'){
trHTML += '<td>'+days_date[4]+'</td>';
}
trHTML += '<td>Y</td>';
trHTML += '<td>'+item.start_date+'</td>';
trHTML += '<td>'+item.end_date+'</td>';
trHTML += '<td><input type="checkbox" name="presentdays[]" /></td>';
trHTML += '<td><input type="checkbox" name="latedays[]" /></td>';
trHTML += '<td>'+item.expense_allowance_value+'</td>';
trHTML += '<td>'+item.hours_allowed+'</td>';
trHTML += '</tr>';
number_of_classes++;
totalexpense = +totalexpense + +item.expense_allowance_value;
totaladminhours = totaladminhours + item.hours_allowed;
}
});
jQuery('#steptwotable').find('tbody').empty();
jQuery('#steptwotable').find('tbody').append(trHTML);
var totalclasses = number_of_classes * jQuery("input[name='txtclassrate']").val();
var totaladminrate = totaladminhours * jQuery("input[name='txtadminrate']").val();
var trHTML2 = '';
trHTML2 += '<tr>';
trHTML2 += '<td>'+number_of_classes+'</td>';
trHTML2 += '<td><input type="text" value="'+totalclasses+'" readonly /></td>';
trHTML2 += '<td><input type="text" value="" readonly /></td>';
trHTML2 += '<td><input type="text" value="'+totalexpense+'" readonly /></td>';
trHTML2 += '<td><input type="text" value="'+totaladminrate+'" readonly /></td>';
trHTML2 += '</tr>';
jQuery('#stepthreetable').find('tbody').empty();
jQuery('#stepthreetable').find('tbody').append(trHTML2);
}
});
}
});
PHP
<?php
if($_POST['addtimecard']){
// print_r($_POST);
echo json_decode($_POST['alldata']);
}
?>
PHP打印输出
Array ( [txtuser] => 2 [txtemail2] => nitinjohnson316@gmail.com [txtclassrate] => 10.000 [txtadminrate] => 20.000 [txtweek] => 08-31-2015 [txtcomment] => [alldata] => {\"email2\":\"nitinjohnson316@gmail.com\",\"class_rate\":\"10.000\",\"admin_rate\":\"20.000\",\"late_charge\":\"10.000\",\"final_data\":[{\"pre_assignment_id\":\"4\",\"user_id\":\"2\",\"session_id\":\"52\",\"school\":\"Admin\",\"day_of_week\":\"\",\"start_date\":\"1970-01-01\",\"end_date\":\"1970-01-01\",\"expense_allowance_value\":\"0\",\"hours_allowed\":\"5\",\"event_id\":\"999999\",\"event_title\":\"Admin\",\"event_description\":null,\"event_category\":\"Admin\",\"event_status\":\"Active\",\"event_status_num\":\"5\",\"event_timecard\":\"A\",\"session_dayofweek\":\"\",\"session_start_date\":\"0000-00-00\",\"session_end_date\":\"0000-00-00\",\"refresh_tmstp\":\"2015-10-10 18:02:35\"},{\"pre_assignment_id\":\"3\",\"user_id\":\"2\",\"session_id\":\"16\",\"school\":\"Bethany Elementary\",\"day_of_week\":\"Wed\",\"start_date\":\"2015-09-09\",\"end_date\":\"2015-12-12\",\"expense_allowance_value\":\"5\",\"hours_allowed\":\"0\",\"event_id\":\"3481\",\"event_title\":\"Fall 2015 - Bethany Elementary Chess Program - Plano ISD\",\"event_description\":null,\"event_category\":\"Bethany Elementary\",\"event_status\":\"Ongoing\",\"event_status_num\":\"3\",\"event_timecard\":\"C\",\"session_dayofweek\":\"Wed\",\"session_start_date\":\"2015-09-09\",\"session_end_date\":\"2015-12-09\",\"refresh_tmstp\":\"2015-10-10 18:02:35\"},{\"pre_assignment_id\":\"2\",\"user_id\":\"2\",\"session_id\":\"15\",\"school\":\"Ashley Elementary\",\"day_of_week\":\"Mon\",\"start_date\":\"2015-09-14\",\"end_date\":\"2015-12-12\",\"expense_allowance_value\":\"15\",\"hours_allowed\":\"0\",\"event_id\":\"3511\",\"event_title\":\"Fall 2015 - Ashley Elementary Chess Program - Frisco ISD\",\"event_description\":null,\"event_category\":\"Ashley Elementary\",\"event_status\":\"Ongoing\",\"event_status_num\":\"3\",\"event_timecard\":\"C\",\"session_dayofweek\":\"Mon\",\"session_start_date\":\"2015-09-14\",\"session_end_date\":\"2015-12-07\",\"refresh_tmstp\":\"2015-10-10 18:02:35\"},{\"pre_assignment_id\":\"1\",\"user_id\":\"2\",\"session_id\":\"14\",\"school\":\"Anderson Elementary\",\"day_of_week\":\"Mon\",\"start_date\":\"2015-09-21\",\"end_date\":\"2015-12-12\",\"expense_allowance_value\":\"5\",\"hours_allowed\":\"0\",\"event_id\":\"3613\",\"event_title\":\"Fall 2015 - Anderson Elementary Chess Program - Frisco ISD\",\"event_description\":null,\"event_category\":\"Anderson Elementary\",\"event_status\":\"Active Hidden\",\"event_status_num\":\"2\",\"event_timecard\":\"C\",\"session_dayofweek\":\"Mon\",\"session_start_date\":\"2015-09-21\",\"session_end_date\":\"2015-12-07\",\"refresh_tmstp\":\"2015-10-10 18:02:35\"}]} [addtimecard] => Save ) {\"email2\":\"nitinjohnson316@gmail.com\",\"class_rate\":\"10.000\",\"admin_rate\":\"20.000\",\"late_charge\":\"10.000\",\"final_data\":[{\"pre_assignment_id\":\"4\",\"user_id\":\"2\",\"session_id\":\"52\",\"school\":\"Admin\",\"day_of_week\":\"\",\"start_date\":\"1970-01-01\",\"end_date\":\"1970-01-01\",\"expense_allowance_value\":\"0\",\"hours_allowed\":\"5\",\"event_id\":\"999999\",\"event_title\":\"Admin\",\"event_description\":null,\"event_category\":\"Admin\",\"event_status\":\"Active\",\"event_status_num\":\"5\",\"event_timecard\":\"A\",\"session_dayofweek\":\"\",\"session_start_date\":\"0000-00-00\",\"session_end_date\":\"0000-00-00\",\"refresh_tmstp\":\"2015-10-10 18:02:35\"},{\"pre_assignment_id\":\"3\",\"user_id\":\"2\",\"session_id\":\"16\",\"school\":\"Bethany Elementary\",\"day_of_week\":\"Wed\",\"start_date\":\"2015-09-09\",\"end_date\":\"2015-12-12\",\"expense_allowance_value\":\"5\",\"hours_allowed\":\"0\",\"event_id\":\"3481\",\"event_title\":\"Fall 2015 - Bethany Elementary Chess Program - Plano ISD\",\"event_description\":null,\"event_category\":\"Bethany Elementary\",\"event_status\":\"Ongoing\",\"event_status_num\":\"3\",\"event_timecard\":\"C\",\"session_dayofweek\":\"Wed\",\"session_start_date\":\"2015-09-09\",\"session_end_date\":\"2015-12-09\",\"refresh_tmstp\":\"2015-10-10 18:02:35\"},{\"pre_assignment_id\":\"2\",\"user_id\":\"2\",\"session_id\":\"15\",\"school\":\"Ashley Elementary\",\"day_of_week\":\"Mon\",\"start_date\":\"2015-09-14\",\"end_date\":\"2015-12-12\",\"expense_allowance_value\":\"15\",\"hours_allowed\":\"0\",\"event_id\":\"3511\",\"event_title\":\"Fall 2015 - Ashley Elementary Chess Program - Frisco ISD\",\"event_description\":null,\"event_category\":\"Ashley Elementary\",\"event_status\":\"Ongoing\",\"event_status_num\":\"3\",\"event_timecard\":\"C\",\"session_dayofweek\":\"Mon\",\"session_start_date\":\"2015-09-14\",\"session_end_date\":\"2015-12-07\",\"refresh_tmstp\":\"2015-10-10 18:02:35\"},{\"pre_assignment_id\":\"1\",\"user_id\":\"2\",\"session_id\":\"14\",\"school\":\"Anderson Elementary\",\"day_of_week\":\"Mon\",\"start_date\":\"2015-09-21\",\"end_date\":\"2015-12-12\",\"expense_allowance_value\":\"5\",\"hours_allowed\":\"0\",\"event_id\":\"3613\",\"event_title\":\"Fall 2015 - Anderson Elementary Chess Program - Frisco ISD\",\"event_description\":null,\"event_category\":\"Anderson Elementary\",\"event_status\":\"Active Hidden\",\"event_status_num\":\"2\",\"event_timecard\":\"C\",\"session_dayofweek\":\"Mon\",\"session_start_date\":\"2015-09-21\",\"session_end_date\":\"2015-12-07\",\"refresh_tmstp\":\"2015-10-10 18:02:35\"}]}
我从中创建JSON的PHP函数
<?php
add_action('wp_ajax_timecardapp_manage_timecard_stepone','timecardapp_manage_timecard_stepone');
add_action('wp_ajax_nopriv_timecardapp_manage_timecard_stepone','timecardapp_manage_timecard_stepone');
function timecardapp_manage_timecard_stepone(){
global $wpdb;
$wpdb->sessions = $wpdb->prefix . 'tc_sessions';
$wpdb->contractor = $wpdb->prefix . 'tc_contractor';
$get_results=$wpdb->get_results("SELECT * FROM $wpdb->contractor WHERE user_id='".$_POST['user_id']."' ");
$result;
foreach($get_results as $row){
$result['email2'] = $row->email2;
$result['class_rate'] = $row->class_rate;
$result['admin_rate'] = $row->admin_rate;
$result['late_charge'] = $row->late_charge;
}
$wpdb->pre_assignments = $wpdb->prefix . 'tc_pre_assignments';
$session_ids;
$get_pre_assignments=$wpdb->get_results("SELECT * FROM $wpdb->pre_assignments WHERE user_id='".$_POST['user_id']."' ORDER BY start_date, FIELD(start_date,'Sun','Mon','Tue','Wed','Thu','Fri','Sat') ");
foreach($get_pre_assignments as $row){
$session_ids[] = $row->session_id;
}
$final_session_ids=implode(",",$session_ids);
$get_pre_assignments=$wpdb->get_results("SELECT * FROM $wpdb->pre_assignments join $wpdb->sessions ON $wpdb->pre_assignments.session_id=$wpdb->sessions.session_id WHERE $wpdb->sessions.session_id IN(".$final_session_ids.") and user_id='".$_POST['user_id']."' ORDER BY start_date, FIELD(start_date,'Sun','Mon','Tue','Wed','Thu','Fri','Sat') ");
$final_data;
foreach($get_pre_assignments as $row){
$final_data[] = $row;
}
$result['final_data']=$final_data;
$session_names=get_session_detail_by_id($final_session_ids);
echo json_encode($result);
die();
}
?>
试试这个,
$a = $_POST['alldata'];
$arr = json_decode($a);
$email = $arr->email2;
$class_rate = $arr->class_rate;
...
要访问最终数据
,
foreach($arr->final_data as $row) {
echo $row->pre_assignment_id;
echo $row->user_id;
....
}
以同样的方式尝试访问所有必需的变量。
问题在于你的报价。JSON中的双引号与用于分隔值的双引号匹配,因此值在第一个{
后结束。请将分隔符引号更改为单引号。
<input type="hidden" name="alldata" id="alldata" value='{"email2":"nitinjohnson316@gmail.com","class_rate":"10.000","admin_rate":"20.000","late_charge":"10.000","final_data":[{"pre_assignment_id":"4","user_id":"2","session_id":"52","school":"Admin","day_of_week":"","start_date":"1970-01-01","end_date":"1970-01-01","expense_allowance_value":"0","hours_allowed":"5","event_id":"999999","event_title":"Admin","event_description":null,"event_category":"Admin","event_status":"Active","event_status_num":"5","event_timecard":"A","session_dayofweek":"","session_start_date":"0000-00-00","session_end_date":"0000-00-00","refresh_tmstp":"2015-10-10 18:02:35"},{"pre_assignment_id":"3","user_id":"2","session_id":"16","school":"Bethany Elementary","day_of_week":"Wed","start_date":"2015-09-09","end_date":"2015-12-12","expense_allowance_value":"5","hours_allowed":"0","event_id":"3481","event_title":"Fall 2015 - Bethany Elementary Chess Program - Plano ISD","event_description":null,"event_category":"Bethany Elementary","event_status":"Ongoing","event_status_num":"3","event_timecard":"C","session_dayofweek":"Wed","session_start_date":"2015-09-09","session_end_date":"2015-12-09","refresh_tmstp":"2015-10-10 18:02:35"},{"pre_assignment_id":"2","user_id":"2","session_id":"15","school":"Ashley Elementary","day_of_week":"Mon","start_date":"2015-09-14","end_date":"2015-12-12","expense_allowance_value":"15","hours_allowed":"0","event_id":"3511","event_title":"Fall 2015 - Ashley Elementary Chess Program - Frisco ISD","event_description":null,"event_category":"Ashley Elementary","event_status":"Ongoing","event_status_num":"3","event_timecard":"C","session_dayofweek":"Mon","session_start_date":"2015-09-14","session_end_date":"2015-12-07","refresh_tmstp":"2015-10-10 18:02:35"},{"pre_assignment_id":"1","user_id":"2","session_id":"14","school":"Anderson Elementary","day_of_week":"Mon","start_date":"2015-09-21","end_date":"2015-12-12","expense_allowance_value":"5","hours_allowed":"0","event_id":"3613","event_title":"Fall 2015 - Anderson Elementary Chess Program - Frisco ISD","event_description":null,"event_category":"Anderson Elementary","event_status":"Active Hidden","event_status_num":"2","event_timecard":"C","session_dayofweek":"Mon","session_start_date":"2015-09-21","session_end_date":"2015-12-07","refresh_tmstp":"2015-10-10 18:02:35"}]}'>
我有一个简单的表单,它使用foreach($\u POST as$key)将数据插入数据库= 我使用if(isset($\u POST['isset'])){ 我正在尝试解决如何从循环中排除隐藏字段。。。? 我看了这篇文章,但不明白我会在哪里使用(strpos($key,'hdn_') == false)//继续 如何排除 任何指导将不胜感激......
问题内容: 我想知道是否可以将return json存储在隐藏的输入字段中。例如,这是我的json返回的内容: 我只想将ID存储在一个隐藏字段中,以便以后可以引用它来做一些事情。 示例:我有这样的事情: 并希望jQuery稍后将值返回给我,如下所示: 问题答案: 您可以将其存储在隐藏字段中,也可以将其存储在javascript对象(我的偏好)中,因为可能的访问方式是通过javascript。 注意
问题内容: 在以下情况下: 学生“隐藏人的ID字段。 如果我们想在内存中表示以下内容: 约翰对象会为storint Person.ID及其自己拥有两个单独的存储位置吗? 问题答案: 正确。示例中的每个类都有其自己的int IDid字段。 您可以通过以下方式从子类中读取或分配值: 或在外部(当它们是公开的时):
ReactJS新手问题。我正在利用材料UI自动完成谷歌Places API,使用户能够查找位置。除了位置,我还从Google Places API返回了一个“place_id”。问题是,我不清楚存储“place_id”以便在ReactJS中提交最终表单的最佳实践。通常,我只会将它存储到一个隐藏的字段中,但我想知道在ReactJS中这样做的最佳实践是什么?您可以看到我的演示项目https://cod
问题内容: 我正在分析其他人的PHP代码,并且注意到输入HTML包含许多隐藏的输入字段,其名称以’[]’结尾,例如: 处理此输入的PHP页面将获取每个值,如下所示: “ []”的作用是什么?指定会有多个具有相同名称的输入字段? 问题答案: 是。基本上,PHP会知道将所有具有相同名称的值粘贴到数组中。 顺便说一下,这适用于所有输入字段,而不仅仅是隐藏的字段。
问题内容: 我想在文件中放一些东西,以隐藏php文件的文件扩展名,因此转到www.example.com/dir/somepage会显示它们www.example.com/dir/somepage.php。 有什么可行的解决方案吗?我的网站使用HTTPS(如果很重要)。 这是我目前的.htaccess: 问题答案: 在您的.htaccess中在DOCUMENT_ROOT下使用以下代码: