为什么我的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。我添加了一个标签,现在可以工作了。谢谢:)