Пример #1
0
 function __construct($DBname, $DBip, $DBuser, $DBpwd, $memSwitch = false, $memPort, $memName, $memPath)
 {
     $this->DBname = $DBname;
     $this->DBip = $DBip;
     $this->DBuser = $DBuser;
     $this->DBpwd = $DBpwd;
     $this->memcache_switch = $memSwitch;
     try {
         $this->PDO_LINK = new PDO("mysql:host={$this->DBip};dbname={$this->DBname};", $this->DBuser, $this->DBpwd);
         if ($memSwitch == true) {
             \RSystem\system::load_class($memName, $memPath, 0);
             memcacheClass::init($memPort);
         }
         $this->PDO_LINK->setAttribute(PDO::ATTR_AUTOCOMMIT, 1);
         $this->PDO_LINK->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
         // $this->PDO_LINK->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
     } catch (PDOException $e) {
         die("connect fail!" . $e->getMessage());
     }
     $this->PDO_LINK->query('set names utf8');
 }
Пример #2
0
 public function testPostView()
 {
     echo \RSystem\system::drawViews('test');
 }
Пример #3
0
<?php

/**************************************************************************
 * Created by PhpStorm.
 * 入口文件
 * 作者:NumberWolf
 * Email:porschegt23@foxmail.com
 * APACHE 2.0 LICENSE
 * Copyright [2016] [Chang Yanlong]

 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 **************************************************************************/
define('RollerPHP', dirname(__FILE__));
define('System', '/System');
define('URL_HEAD', preg_replace("/(\\/index\\.php\\/.+)/ism", '', $_SERVER['PHP_SELF']));
include RollerPHP . System . '/system.php';
\RSystem\system::init();
Пример #4
0
 * 核心路由

 * Created by PhpStorm.
 * 作者:NumberWolf
 * Email:porschegt23@foxmail.com
 * APACHE 2.0 LICENSE
 * Copyright [2016] [Chang Yanlong]

 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

 **************************************************************************/
$app_router = \RSystem\system::load_config('config');
Roller($app_router);
function Roller($app_router)
{
    $route_arr = explode("/", preg_replace(array("/(index\\.php\\/)/ism", "/(\\?\\/)/ism", "/(" . PROJECT_NAME . "\\/)/ism"), '', $_SERVER['REQUEST_URI']));
    $route_arr = array_values(array_diff($route_arr, array(null, '', 'null', ' ')));
    $route_home = count($route_arr) > 0 ? $route_arr[0] : $app_router['Home'];
    $route_control = count($route_arr) > 1 ? $route_arr[1] : $app_router['Cont'];
    $route_method = count($route_arr) > 2 ? $route_arr[2] : $app_router['Meth'];
    //$route_method = preg_match('/^[a-zA-Z0-9]/' , $_GET['Meth']) ? $_GET['Meth'] : $app_router['Meth'];
    $module = CONT_PATH . '/' . $route_home;
    $controller = $module . '/' . $route_control . '.php';
    if (!is_dir($module)) {
        die('<h1>RollerPHP: \'' . $route_home . '\' 找不到</h1>');
    }
    if (!file_exists($controller)) {
 public function __construct()
 {
     $this->PDO_OBJ = \RSystem\system::load_pdo('', true, 11211);
     // 当为true时候打开memcache缓存
     echo "数据模型实例,已开启缓存";
 }