无法调用苗条框架API [英] Unable to call API of slim framework

查看:244
本文介绍了无法调用苗条框架API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设计使用超薄框架PHP的API。这些都是我的本地系统和我的公网IP​​上正常工作。但现在我上传这些API文件到我公司的服务器。

I am designing an API in PHP using slim framework. These are working fine on my local system and my public IP. But now I upload these APIs files on to my company server.

现在我试图访问API存储我公司的服务器上,但这些都显示空白页面,这意味着我无法调用API。

Now I am trying to access API stored on my company's server but these are showing empty pages, this means I am unable to call API.

下面是API

<?php

include('connect.php');

header('Content-type: text/xml');
header('Content-type: application/json');

// Include the Slim library
require 'Slim/Slim.php';

// Instantiate the Slim class
$app = new Slim();

$app->get('/', function () {
    echo "Pericent is working on Campus Concierge...";
});

$app->run();

?>

这是在本地工作正常,但它没有显示时,我要访问公司服务器什么。

This is working correctly locally, but it is not showing anything when I want to access company server.

推荐答案

建议的 PHP> = 5.3 即可享受Slim的匿名函数的支持等为获取,POST,PUT和删除

It is recommend PHP >= 5.3 to enjoy Slim's support for anonymous functions like as Get,Post,put and delete.

因此​​,如果我们想用SLIM架构做出的API,我们需要更新我们的PHP> = 5.3。然后你的API,如GET​​和邮政将成功运行。

So if we want to make APIs using SLIM framework we need to update our PHP>=5.3. Then your APIs like as Get and Post will work successfully.

这篇关于无法调用苗条框架API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆