Exemple #1
0
 public static function DoAction()
 {
     self::$postObj = self::GetRequestXMLData();
     if (self::$postObj === FALSE || !isset(self::$postObj->FromUserName) || !isset(self::$postObj->ToUserName) || !isset(self::$postObj->CreateTime) || !isset(self::$postObj->MsgType) || \Web\Utils\StringUtitly::IsBlank(self::$postObj->FromUserName) || \Web\Utils\StringUtitly::IsBlank(self::$postObj->ToUserName) || \Web\Utils\StringUtitly::IsBlank(self::$postObj->CreateTime) || \Web\Utils\StringUtitly::IsBlank(self::$postObj->MsgType)) {
         \Web\Utils\MPXML::TextAlertEx(0, 0, "request error");
         exit;
     }
     $ControllerClass = "\\Web\\Controller\\MPMsg\\MType_" . strtoupper(self::$Context->MsgType);
     if (!class_exists($ControllerClass, true)) {
         \Web\Utils\Logger::Error(self::$postObj, "MsgType Not Class Attach");
         \Web\Utils\MPXML::TextAlert(self::$postObj, "MsgType Not Class Attach");
     }
     $openid = self::$postObj->FromUserName;
     self::$Context = new $ControllerClass();
     self::$Context->Initialize();
 }
Exemple #2
0
<?php

require_once __DIR__ . "/../data/Framework.Config.php";
require_once __DIR__ . '/../include/Web.Framework/Core.Class.php';
Web\Framework\Core::InitFramework(__DIR__);
//初使化框架
/**
 * Created by PhpStorm.
 * User: William
 * Date: 2015/1/20
 * Time: 15:06
 */
final class WebRouter extends \Web\Framework\Router
{
    /**
     * 网站名称
     */
    const WebName = 'WXDemo';
    /**
     * @var \Web\Controller\ControllerBase
     */
    public static $Context;
}
WebRouter::DoAction();
 /**
  * 快速生成符合标准的url
  * @param $folderArray array 路径数组
  * @param mixed $qus get参数,可以是一个字符串或者一个数组
  * @return string
  */
 public function getURL($set = null, $page = null, $action = null, $qus = null)
 {
     $wr = WebRouter::init();
     return $wr->getURL($set, $page, $action, $qus);
 }
Exemple #4
0
 /**
  * 释放当前类
  */
 public static function release()
 {
     self::$selfObject = null;
 }
Exemple #5
0
<?php

// 运行框架核心内容
/**
 * appinfo除了记载post,get等信息,还会记载当前运行的类的加载信息
 * @var AppInfo
 */
$globalAppInfo = new AppInfo();
$router = WebRouter::init($globalAppInfo);
$globalAppInfo->webRouter = $router;
while ($router instanceof RouterInterface) {
    $router->exec();
    if ($router instanceof WebRouterInterface) {
        $_GET = $router->getGet();
        $_POST = $router->getPost();
    }
    // 并解析下一个对象
    $router = $router->getTransformClass();
}
// 运行分析出的Runnable对象
$object = $router;
if ($object instanceof RunnableInterface) {
    $object->exec($globalAppInfo->action);
    $object->release();
}
Exemple #6
0
<?php

/*** include the init-helper file ***/
require_once 'init.php';
/*** get url from script ***/
$routerPath = isset($_GET['r']) ? $_GET['r'] : 'Default';
/*** extract components from url, load controller and launch method with args ***/
$router = new WebRouter($routerPath);
$controllerName = $router->getControllerName();
$controller = new $controllerName();
$controller->callMethod($router->getMethod(), $router->getArgs());
 public function Execute()
 {
     \WebRouter::ChangeTemplatePath('User', 'Login');
     echo '-Execute-';
 }