Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/285.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法修复我的php页面中未定义的索引_Php_Jquery_Html_Ajax - Fatal编程技术网

无法修复我的php页面中未定义的索引

无法修复我的php页面中未定义的索引,php,jquery,html,ajax,Php,Jquery,Html,Ajax,我试图从我的html页面访问令牌,该页面的输入元素具有该令牌 当我在Windows7的服务器(wamp)上运行此页面时。我在“api_键”上得到一个未定义索引的错误。我怎么修理它? php代码: <?php $Cname=$_POST['api_key']; if($Cname=="To-do") { $api_key=$_POST['api_key']; $file1="i have some url here not mentioning i

我试图从我的html页面访问令牌,该页面的输入元素具有该令牌 当我在Windows7的服务器(wamp)上运行此页面时。我在“api_键”上得到一个未定义索引的错误。我怎么修理它? php代码:

  <?php
    $Cname=$_POST['api_key'];
    if($Cname=="To-do")
    {
    $api_key=$_POST['api_key'];
    $file1="i have some url here not mentioning it for valid reason".$api_key;
    $data = file_get_contents($file1);
    $json_o=json_decode($data);
    echo "<pre>";
    print_r($json_o);
    echo "</pre>";
    }
    ?>

//html page:
//script is within head
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js "></script>
<script type="text/javascript">
$(document).ready(function() {
      $("#postJson").click(function(event){
          $.post( 
             "get_task_by_column.php",{hidden:$('#api_key').val()},
             function(data) {
            $('#response').html(data);

             }

          );
      });
});

</script>
//body starts
<div>
    <form>  
    <input type="hidden" name="api_key" value="024b427a5d41a62edd218bddb55ed1fc" id="api_key" >
    <input type="text" id="txthtml">
    <input type="button" value="Get tasks by column name" id="postJson"/>

    </div>

    <div id='response'></div>

    </form>

//html页面:
//脚本在头部
$(文档).ready(函数(){
$(“#postJson”)。单击(函数(事件){
$邮政(
“get_task_by_column.php”{hidden:$('api_key').val(),
功能(数据){
$('#response').html(数据);
}
);
});
});
//身体开始
更改这些

$Cname=isset($_POST['api_key'])?$_POST['api_key']:null;
$api_key=isset($_POST['api_key'])?$_POST['api_key']:null;
对这些

"get_task_by_column.php",{hidden:$('#api_key').val()},
在js部分

 "get_task_by_column.php",{api_key:$('#api_key').val()},

改变这些

$Cname=isset($_POST['api_key'])?$_POST['api_key']:null;
$api_key=isset($_POST['api_key'])?$_POST['api_key']:null;
对这些

"get_task_by_column.php",{hidden:$('#api_key').val()},
在js部分

 "get_task_by_column.php",{api_key:$('#api_key').val()},

改变这些

$Cname=isset($_POST['api_key'])?$_POST['api_key']:null;
$api_key=isset($_POST['api_key'])?$_POST['api_key']:null;
对这些

"get_task_by_column.php",{hidden:$('#api_key').val()},
在js部分

 "get_task_by_column.php",{api_key:$('#api_key').val()},

改变这些

$Cname=isset($_POST['api_key'])?$_POST['api_key']:null;
$api_key=isset($_POST['api_key'])?$_POST['api_key']:null;
对这些

"get_task_by_column.php",{hidden:$('#api_key').val()},
在js部分

 "get_task_by_column.php",{api_key:$('#api_key').val()},

使用
isset()


使用
isset()


使用
isset()


使用
isset()


$\u POST
中的索引是
隐藏的
,如果需要
api\u键
,请更改

api_key: $('#api_key').val()


$\u POST
中的索引是
隐藏的
,如果需要
api\u键
,请更改

api_key: $('#api_key').val()


$\u POST
中的索引是
隐藏的
,如果需要
api\u键
,请更改

api_key: $('#api_key').val()


$\u POST
中的索引是
隐藏的
,如果需要
api\u键
,请更改

api_key: $('#api_key').val()


您发布的值将是
$\u POST['hidden']
,因为这是您在jQuery中定义的值

如果您希望它是api_密钥

换成

<?php

    $Cname = false;
    if(isset($_POST['api_key'])){
        $Cname=true;
    }

    if(isset($_POST['toDo']) && $_POST['toDo'] == "To-do" && $Cname){
        $api_key=$_POST['api_key'];
        $file1="i have some url here not mentioning it for valid reason".$api_key;
        $data = file_get_contents($file1);
        $json_o=json_decode($data);
        echo "<pre>";
        print_r($json_o);
        echo "</pre>";
    }
?>

//html page:
//script is within head
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js "> </script>
<script type="text/javascript">
    $(document).ready(function() {
       $("#postJson").click(function(event){
          $.post("get_task_by_column.php",{api_key:$('#api_key').val(), toDo:1}, function(data) {$('#response').html(data);});
      });
    });
</script>
//body starts
<div>
    <form action="index.php" method="post">   
        <input type="hidden" name="api_key" value="024b427a5d41a62edd218bddb55ed1fc" id="api_key" >
        <input type="text" id="txthtml">
        <input type="submit" value="Get tasks by column name" id="postJson"/>
    </form>
</div>
<div id='response'></div>

您发布的值将是
$\u POST['hidden']
,因为这是您在jQuery中定义的值

如果您希望它是api_密钥

换成

<?php

    $Cname = false;
    if(isset($_POST['api_key'])){
        $Cname=true;
    }

    if(isset($_POST['toDo']) && $_POST['toDo'] == "To-do" && $Cname){
        $api_key=$_POST['api_key'];
        $file1="i have some url here not mentioning it for valid reason".$api_key;
        $data = file_get_contents($file1);
        $json_o=json_decode($data);
        echo "<pre>";
        print_r($json_o);
        echo "</pre>";
    }
?>

//html page:
//script is within head
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js "> </script>
<script type="text/javascript">
    $(document).ready(function() {
       $("#postJson").click(function(event){
          $.post("get_task_by_column.php",{api_key:$('#api_key').val(), toDo:1}, function(data) {$('#response').html(data);});
      });
    });
</script>
//body starts
<div>
    <form action="index.php" method="post">   
        <input type="hidden" name="api_key" value="024b427a5d41a62edd218bddb55ed1fc" id="api_key" >
        <input type="text" id="txthtml">
        <input type="submit" value="Get tasks by column name" id="postJson"/>
    </form>
</div>
<div id='response'></div>

您发布的值将是
$\u POST['hidden']
,因为这是您在jQuery中定义的值

如果您希望它是api_密钥

换成

<?php

    $Cname = false;
    if(isset($_POST['api_key'])){
        $Cname=true;
    }

    if(isset($_POST['toDo']) && $_POST['toDo'] == "To-do" && $Cname){
        $api_key=$_POST['api_key'];
        $file1="i have some url here not mentioning it for valid reason".$api_key;
        $data = file_get_contents($file1);
        $json_o=json_decode($data);
        echo "<pre>";
        print_r($json_o);
        echo "</pre>";
    }
?>

//html page:
//script is within head
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js "> </script>
<script type="text/javascript">
    $(document).ready(function() {
       $("#postJson").click(function(event){
          $.post("get_task_by_column.php",{api_key:$('#api_key').val(), toDo:1}, function(data) {$('#response').html(data);});
      });
    });
</script>
//body starts
<div>
    <form action="index.php" method="post">   
        <input type="hidden" name="api_key" value="024b427a5d41a62edd218bddb55ed1fc" id="api_key" >
        <input type="text" id="txthtml">
        <input type="submit" value="Get tasks by column name" id="postJson"/>
    </form>
</div>
<div id='response'></div>

您发布的值将是
$\u POST['hidden']
,因为这是您在jQuery中定义的值

如果您希望它是api_密钥

换成

<?php

    $Cname = false;
    if(isset($_POST['api_key'])){
        $Cname=true;
    }

    if(isset($_POST['toDo']) && $_POST['toDo'] == "To-do" && $Cname){
        $api_key=$_POST['api_key'];
        $file1="i have some url here not mentioning it for valid reason".$api_key;
        $data = file_get_contents($file1);
        $json_o=json_decode($data);
        echo "<pre>";
        print_r($json_o);
        echo "</pre>";
    }
?>

//html page:
//script is within head
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js "> </script>
<script type="text/javascript">
    $(document).ready(function() {
       $("#postJson").click(function(event){
          $.post("get_task_by_column.php",{api_key:$('#api_key').val(), toDo:1}, function(data) {$('#response').html(data);});
      });
    });
</script>
//body starts
<div>
    <form action="index.php" method="post">   
        <input type="hidden" name="api_key" value="024b427a5d41a62edd218bddb55ed1fc" id="api_key" >
        <input type="text" id="txthtml">
        <input type="submit" value="Get tasks by column name" id="postJson"/>
    </form>
</div>
<div id='response'></div>

在发布api值之前,您正在访问
$\u POST['api\u key']


//html页面:
//脚本在头部
$(文档).ready(函数(){
$(“#postJson”)。单击(函数(事件){
$邮政(
“get_task_by_column.php”{hidden:$('api_key').val(),
功能(数据){
$('#response').html(数据);
}
);
});
});
//身体开始

您正在访问
$\u POST['api\u key']
POST api\u值之前


//html页面:
//脚本在头部
$(文档).ready(函数(){
$(“#postJson”)。单击(函数(事件){
$邮政(
“get_task_by_column.php”{hidden:$('api_key').val(),
功能(数据){
$('#response').html(数据);
}
);
});
});
//身体开始

您正在访问
$\u POST['api\u key']
POST api\u值之前


//html页面:
//脚本在头部
$(文档).ready(函数(){
$(“#postJson”)。单击(函数(事件){
$邮政(
“get_task_by_column.php”{hidden:$('api_key').val(),
功能(数据){
$('#response').html(数据);
}
);
});
});
//身体开始

您正在访问
$\u POST['api\u key']
POST api\u值之前


//html页面:
//脚本在头部
$(文档).ready(函数(){
$(“#postJson”)。单击(函数(事件){
$邮政(
“get_task_by_column.php”{hidden:$('api_key').val(),
功能(数据){
$('#response').html(数据);
}
);
});
});
//身体开始
试试这个


//html页面:
//脚本在头部
$(文档).ready(函数(){
$(“#postJson”)。单击(函数(事件){
$.post(“get_task_by_column.php”,{api_key:$(''api_key').val(),toDo:1},函数(数据){$('#response').html(数据);});
});
});
//身体开始
试试这个


//html页面:
//脚本在头部
$(文档).ready(函数(){
$(“#postJson”)。单击(函数(事件){
$.post(“get_task_by_column.php”,{api_key:$(''api_key').val(),toDo:1},函数(数据){$('#response').html(数据);});
});
});
//身体开始
试试这个


//html页面:
//脚本在头部
$(文档).ready(函数(){
$(“#postJson”)。单击(函数(事件){
$.post(“get_task_by_column.php”,{api_key:$(''api_key').val(),toDo:1},函数(数据){$('#response').html(数据);});
});
});
//身体开始
试试这个


//html页面:
//脚本在头部
$(文档).ready(函数(){
$(“#postJson”)。单击(函数(事件){
$.post(“get_task_by_column.php”,{api_key:$(''api_key').val(),toDo:1},函数(数据){$('#response').html(数据);});
});
});
//身体开始

谢谢您宝贵的时间,但仍然无法工作。请帮助我out@user3386765请检查发送的参数是否使用firebug或开发人员工具?感谢您宝贵的时间,但还是不行,请帮帮我out@user3386765请检查参数是否使用firebug或开发工具发送?感谢您宝贵的时间,但仍然无法工作。请帮助我out@user3386765请检查是否