Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.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_Function_File_Class_Curl - Fatal编程技术网

为什么我的PHP函数不是从另一个文件启动的?

为什么我的PHP函数不是从另一个文件启动的?,php,function,file,class,curl,Php,Function,File,Class,Curl,我在index.php <input type="submit" name="OUs" value="Get all OU's"> namespace Google\OU; define("APIURL_DIRECTORY","https://www.googleapis.com/admin/directory/v1/customer/"); // For Google Directory actions class OU { // Get OU's function

我在
index.php

 <input type="submit" name="OUs" value="Get all OU's">
namespace Google\OU;

define("APIURL_DIRECTORY","https://www.googleapis.com/admin/directory/v1/customer/");  // For Google 
Directory actions

 class OU
{

// Get OU's
function getOUs($token){

    $url = "https://www.googleapis.com/admin/directory/v1/customer/my_customer/orgunits?orgUnitPath=/&type=all";
    $method = "GET";


    echo exeCurl($url,$method);
}
我尝试在
ou.php

 <input type="submit" name="OUs" value="Get all OU's">
namespace Google\OU;

define("APIURL_DIRECTORY","https://www.googleapis.com/admin/directory/v1/customer/");  // For Google 
Directory actions

 class OU
{

// Get OU's
function getOUs($token){

    $url = "https://www.googleapis.com/admin/directory/v1/customer/my_customer/orgunits?orgUnitPath=/&type=all";
    $method = "GET";


    echo exeCurl($url,$method);
}
当我点击提交按钮时什么也没发生的原因是什么?它应该执行Curl调用,不是吗?
我真的搞不懂。提前谢谢。

你的表单标签是什么?什么是“无事发生”的意思?@abracadver我没有表单标签。这只是一个包含松散元素的表,我希望cURL调用的响应会显示在index.php的屏幕上。您必须提交一个表单。或者一些被调用并收集数据并提交的JS。我添加了一个标签,现在可以工作了。谢谢:)