码迷,mamicode.com
首页 > Web开发 > 详细

library/run.php

时间:2015-12-17 10:48:36      阅读:139      评论:0      收藏:0      [点我收藏+]

标签:

<?php

$request = $_SERVER["REQUEST_URI"];

$params = str_replace(‘/basketball/‘,‘‘,$request);

if( empty( $params ) ) {
header(‘HTTP/1.1 503 Service Unavailable.‘, TRUE, 503);
echo ‘Your view folder path does not appear to be set correctly. Please open the following file and correct this: ‘.SELF;
exit(3); // EXIT_CONFIG
}
if( strpos( $params ,‘/‘) ) {
$params = explode(‘/‘,$params);
$control = $params[0];
$action = $params[1];
if( strpos($action , ‘%EF%BC%9F‘) || strpos( $action , ‘?‘ ) ) {
$explode = strpos($action , ‘%EF%BC%9F‘) ? ‘%EF%BC%9F‘ : ‘?‘;
$action = explode( $explode , $action);
$action = $action[0];
}
} else {
$control = $params;
$action = ‘index‘;
}
$curPath = CONTROL_PATH.DIRECTORY_SEPARATOR.$control.‘.control‘.FILE_EXT;

if( !file_exists($curPath) ){
header(‘HTTP/1.1 503 Service Unavailable.‘, TRUE, 503);
echo ‘Your view folder path does not appear to be set correctly. Please open the following file and correct this: ‘.$control.‘.control.php‘;
exit(3); // EXIT_CONFIG
}

require LIBRARY_PATH.DIRECTORY_SEPARATOR.‘mysql‘.DIRECTORY_SEPARATOR.‘mysql‘.FILE_EXT;

require LIBRARY_PATH.DIRECTORY_SEPARATOR.‘control‘.FILE_EXT;

require FUNCTION_PATH.DIRECTORY_SEPARATOR.‘application‘.FILE_EXT;

require FUNCTION_PATH.DIRECTORY_SEPARATOR.‘language‘.FILE_EXT;

require $curPath;

if ( !class_exists ( $control ) ) {
header(‘HTTP/1.1 503 Service Unavailable.‘, TRUE, 503);
echo ‘Your view folder path does not appear to be set correctly. Please open the following file and correct this: ‘.$control.‘.control.php‘;
exit(3); // EXIT_CONFIG
}
$obj = new $control;

if( !method_exists( $control, $action ) ) {
header(‘HTTP/1.1 503 Service Unavailable.‘, TRUE, 503);
echo ‘Your view folder path does not appear to be set correctly. Please open the following file and correct this: ‘.$control.‘.control.php function:‘.$action;
exit(3); // EXIT_CONFIG
}

define(‘USER_TOKEN‘,‘user_token‘);

$obj->$action();

library/run.php

标签:

原文地址:http://www.cnblogs.com/chinablog100/p/5053181.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!