本文整理汇总了PHP中request::getPathInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP request::getPathInfo方法的具体用法?PHP request::getPathInfo怎么用?PHP request::getPathInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类request
的用法示例。
在下文中一共展示了request::getPathInfo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: boot
static function boot()
{
$pathinfo = request::getPathInfo();
// 生成part
if (isset($pathinfo[1])) {
if ($p = strpos($pathinfo, '/', 2)) {
$part = substr($pathinfo, 0, $p);
} else {
$part = $pathinfo;
}
} else {
$part = '/';
}
if ($part == '/openapi') {
return kernel::single('base_rpc_service')->process($pathinfo);
} elseif ($part == '/app-doc') {
//cachemgr::init();
return kernel::single('base_misc_doc')->display($pathinfo);
}
// 确认是否安装流程. 如果是安装流程则开启debug. 如果不是则检查是否安装, 如果未安装则跳到安装流程
// 目前其他的url, 都应移到routes中进行
//
if ($part == '/setup') {
config::set('app.debug', true);
} else {
static::checkInstalled();
}
cacheobject::init();
static::registRouteMiddleware();
$response = route::dispatch(request::instance());
// 临时处理方式
kernel::single('base_session')->close();
$response->send();
exit;
}
示例2: run
function run($params = array())
{
$this->check_params = $params;
$return = array();
$totalScore = 0;
$allow_install = true;
$func_prefix = 'test_';
foreach (get_class_methods($this) as $func) {
if (substr($func, 0, 5) == $func_prefix) {
$score = 0;
$result = $this->{$func}($score);
if ($result['items']) {
$group[$result['group']]['type'] = $result['type'];
$group[$result['group']]['items'] = array_merge($group[$result['group']['items']] ? $group[$result['group']['items']] : array(), $result['items']);
if ($allow_install && isset($result['allow_install'])) {
$allow_install = $result['allow_install'];
}
if ($result['key']) {
$return[$result['key']] =& $group[$result['group']]['items'];
}
}
$totalScore += $score;
}
}
$score = floor($totalScore / 100) + 1;
$rank = min($score, $this->maxLevel + 1);
$level = array('E', 'D', 'C', 'B', 'A', 'S');
$return['data'] = $group;
$return['score'] = $totalScore;
$return['level'] = $level[$rank - 1];
$return['rank'] = $rank;
$return['allow_install'] = $allow_install;
$return['path_info'] = request::getPathInfo();
return $return;
}
示例3: test_server_req
//.........这里部分代码省略.........
$allow_install = false;
}
$rst = function_exists('xml_parse_into_struct');
$items['php可以解析xml文件'] = array('value' => $rst ? app::get('dev')->_('支持') : app::get('dev')->_('不支持'), 'result' => $rst);
if (!$rst) {
$allow_install = false;
}
$rst = function_exists('mysql_connect') && function_exists('mysql_get_server_info');
$items['MySQL函数库可用'] = array('value' => $rst ? mysql_get_client_info() : app::get('dev')->_('未安装'), 'result' => $rst);
$username = config::get('database.username');
$host = config::get('database.host');
$password = config::get('database.password');
$database = config::get('database.database');
if (!$rst) {
$allow_install = false;
} else {
$rst = false;
if (!is_null($host)) {
if (!is_null($password)) {
$rs = mysql_connect($host, $username, $password);
} elseif (!is_null($username)) {
$rs = mysql_connect($host, $username);
} else {
$rs = mysql_connect($host);
}
$db_ver = mysql_get_server_info($rs);
} elseif ($db_ver = mysql_get_server_info()) {
$host = '';
} else {
$sock = get_cfg_var('mysql.default_socket');
if (PHP_OS != 'WINNT' && file_exists($sock) && is_writable($sock)) {
$host = $sock;
} else {
$host = ini_get('mysql.default_host');
$port = ini_get('mysql.default_port');
if (!$host) {
$host = '127.0.0.1';
}
if (!$port) {
$port = 3306;
}
$host = $host . ':' . $port;
}
}
if (!$db_ver) {
if (substr($host, 0, 1) == '/') {
$fp = @fsockopen("unix://" . $host);
} else {
if ($p = strrpos($host, ':')) {
$port = substr($host, $p + 1);
$host = substr($host, 0, $p);
} else {
$port = 3306;
$host = $host;
}
$fp = @fsockopen("tcp://" . $host, $port, $errno, $errstr, 2);
}
if (!$fp) {
$db_ver = app::get('dev')->_('无法连接');
} else {
fwrite($fp, "\n");
$db_ver = fread($fp, 20);
fclose($fp);
if (preg_match('/([2-8]\\.[0-9\\.]+)/', $db_ver, $match)) {
$db_ver = $match[1];
$rst = version_compare($db_ver, '4.0', '>=');
} else {
$db_ver = app::get('dev')->_('无法识别');
}
}
} else {
$rst = version_compare($db_ver, '4.1', '>=');
}
$this->db_ver = $db_ver;
$mysql_key = app::get('dev')->_('数据库Mysql 4.1以上') . ' <i style="color:#060">' . $host . '</i>';
if ($this->allow_change_db) {
$mysql_key .= '<form method="get" action="" style="margin:0;padding:0"><table><tr><td><label for="db_host">' . app::get('dev')->_('MySQL主机') . '</label></td><td> </td></tr><tr><td><input id="db_host" value="' . $host . '" name="db_host" style="width:100px;" type="text" /></td><td><input type="submit" value="' . app::get('dev')->_('连接') . '"></td></tr></table></form>';
}
$items[$mysql_key] = array('value' => $db_ver, 'result' => $rst);
if (!$rst) {
$allow_install = false;
}
$pathinfo = request::getPathInfo();
if (!$pathinfo) {
$allow_install = false;
}
$items['pathinfo()的支持'] = array('value' => $pathinfo ? app::get('dev')->_('支持') : app::get('dev')->_('不支持'), 'result' => $pathinfo);
return array('group' => app::get('dev')->_('基本需求'), 'items' => $items, 'type' => 'require', 'allow_install' => $allow_install);
}
if (ini_get('safe_mode')) {
$rst = is_callable('ftp_connect');
if (!$rst) {
$allow_install = false;
}
$items['当安全模式开启时,ftp函数可用'] = array('value' => $rst ? app::get('dev')->_('可用') : app::get('dev')->_('不可用'), 'result' => $rst);
}
$rst = preg_match('/[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+/', gethostbyname('www.example.com'));
$items['DNS配置完成,本机上能通过域名访问网络'] = array('value' => $rst ? app::get('dev')->_('成功') : app::get('dev')->_('失败 (将影响部分功能)'), 'result' => $rst);
return array('group' => app::get('dev')->_('基本需求'), 'key' => 'require', 'items' => $items, 'type' => 'require', 'allow_install' => $allow_install);
}