public function index() { //$this->jump('/login',true); echo "<br>"; echo "in index"; echo "<br>"; $xz = new Xcrypt(); $num = rand(10000, 20000) . rand(10000, 20000) . rand(10000, 20000); $res = $xz->encode($num); echo $res; echo '<br>'; $login = Pi::com('login'); $res = $login->dologin(array('111' => 1241, 'hihu' => 1241)); print_r($res); // $q = new Queue("hihu",'users',600); // $q->push(array("queue"=>'真的')); // $q->push(array("queue"=>'真的')); // $q->push(array("queue"=>'真的')); // var_dump($q->getSize()); // var_dump($q->pop()); // var_dump($q->pop()); // var_dump($q->getSize()); // var_dump($q->clear()); // var_dump($q->pop()); }
static function Server() { $mod = Comm::req('mod'); $add = Comm::req('add'); $method = Comm::req('method'); $args = Comm::req('param', array()); try { $class = Pi::com($mod, $add, true); if (is_callable(array($class, $method))) { $reflection = new ReflectionMethod($class, $method); $argnum = $reflection->getNumberOfParameters(); if ($argnum > count($args)) { self::output("inner api call the {$method} from {$mod} {$add} with err args", 5010); } //公共方法才允许被调用 $res = $reflection->invokeArgs($class, $args); self::output($res); } self::output("inner api not callable the {$mod} {$add} from {$method} fail", 5009); } catch (Exception $e) { self::output("inner api execute the {$mod} {$add} from {$method} fail", 5008); } }
<?php //酌情去掉的配置 define('TIMEZONE', 'Asia/Shanghai'); define("__PI_EN_DEBUG", 1); //必要配置 define('PI_ROOT', dirname(__FILE__) . '/'); define('PI_COM_ROOT', PI_ROOT . 'com/'); include PI_ROOT . 'core/Pi.php'; $login = Pi::com('login'); $res = $login->dologin(array('111' => 1241, 'hihu' => 1241)); print_r($res);