|
|
<?php
|
|
|
namespace QSnsApi;
|
|
|
class Config
|
|
|
{
|
|
|
public static $production = "/service/";
|
|
|
|
|
|
public static $testing = "/service/";
|
|
|
|
|
|
public static $developer = "/service/";
|
|
|
|
|
|
/**
|
|
|
* ClassNameUriList ,
|
|
|
* 可以定义不同的方法的地址,主要是本地开发使用
|
|
|
* 或者使用非本站点的Service
|
|
|
* @var array
|
|
|
*/
|
|
|
public static $productionClassNameUri = array(
|
|
|
'admin.profile' => 'http://www.qin.com/service/admin/profile'
|
|
|
);
|
|
|
|
|
|
/**
|
|
|
* 测试配置列表
|
|
|
* @var array
|
|
|
*/
|
|
|
public static $testingClassNameUri = array();
|
|
|
|
|
|
/**
|
|
|
* 开发者配置列表
|
|
|
* @var array
|
|
|
*/
|
|
|
public static $developerClassNameUri = array(
|
|
|
'admin.profile' => 'http://www.yoho.com/service/admin/profile',
|
|
|
);
|
|
|
|
|
|
/**
|
|
|
* 获取URI
|
|
|
* @param $className
|
|
|
* @return string
|
|
|
*/
|
|
|
public static function getUri($className)
|
|
|
{
|
|
|
$environ = ini_get('yaf.environ');
|
|
|
$environClassName = $environ . 'ClassNameUri';
|
|
|
if (!property_exists('QApi\Config', $environClassName)) {
|
|
|
throw new \Exception('Environ Class Is Null.');
|
|
|
}
|
|
|
$environClassList = self::$$environClassName;
|
|
|
if (isset($environClassList[$className])) {
|
|
|
return $environClassList[$className];
|
|
|
}
|
|
|
if (!isset(self::$$environ) || !isset($_SERVER['HTTP_HOST'])) {
|
|
|
throw new \Exception('Service Url Is Null.');
|
|
|
}
|
|
|
$className = str_replace(array('.'), array('/'), $className);
|
|
|
return 'http://' . $_SERVER['HTTP_HOST'] . self::$$environ . $className;
|
|
|
}
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|