Example #1
0
 /**
  * 析构函数
  */
 public function __destruct()
 {
     global $lang;
     view::assign('class', sharePHP::get_class());
     view::assign('action', sharePHP::get_method());
     view::display();
 }
Example #2
0
 /**
  * 显示模板
  * @param $file_name 模板文件名(默认是类名/方法名)
  */
 public static function display($file_name = '')
 {
     if (!$file_name) {
         $file_name = sharePHP::get_class() . '/' . sharePHP::get_method();
     }
     //寻找模板文件
     self::$display = $file_name;
     $path = self::dir() . $file_name;
     $file_name = $path . '.php';
     if (!file_exists($file_name)) {
         return;
     }
     //把变量导入模板文件
     foreach (self::$vars as $var_k_tmp => $var_v_tmp) {
         eval('$' . $var_k_tmp . ' = ' . var_export($var_v_tmp, true) . ";\r\n");
     }
     require $file_name;
 }
Example #3
0
 /**
  * 构造函数
  */
 public function __construct()
 {
     if (sharePHP::get_mode() === 2) {
         $get = fliter($_SERVER['REQUEST_URI']);
         $class = sharePHP::get_class();
         $method = sharePHP::get_method();
         $i = strpos(fliter($_SERVER['REQUEST_URI']), $class . '/' . $method);
         $get = explode('/', substr($get, $i + strlen($class . '/' . $method) + 1));
         $flag = null;
         foreach ($get as $k => $g) {
             if ($flag === null) {
                 $GLOBALS['_GET'][$g] = '';
                 $flag = fliter($g);
             } else {
                 $GLOBALS['_GET'][$flag] = fliter($g);
                 $flag = null;
             }
         }
     }
 }