<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                ### :-: **視圖核心類** ~~~ <?php namespace core; use Twig\Environment; use Twig\Loader\FilesystemLoader; use core\twig\TwigExtension; /** * View 視圖類 */ class View { protected $_controller; protected $_action; protected $_assign = array(); function __construct($controller, $action) { $this->_controller = strtolower($controller); $this->_action = strtolower($action); } /** * 視圖類 分配變量 * @param $name string * @param $value */ public function assign(string $name, $value) { $this->_assign[$name] = $value; } /** * 視圖類 Smarty渲染顯示 * @param $name string * @param $path string */ public function render(string $name, string $path = '') { $config['cache'] = BASE_PATH . '/runtime/view'; if (APP_DEBUG === true) { $config['strict_variables'] = false; $config['debug'] = true; } $loader = new FilesystemLoader(BASE_PATH . '/view/' . $this->_controller . '/'); $twig = new Environment($loader, $config); $twig->addExtension(new TwigExtension()); $twig->addGlobal('_GET', $_GET); $twig->addGlobal('_POST', $_POST); $twig->addGlobal('_SESSION',(new Session)->all()); echo $twig->render($name . '.html', $this->_assign ?: []); } } ~~~ ### :-: **自定義標簽** core\twig\TwigExtension.php ~~~ <?php namespace core\twig; use Twig\Extension\AbstractExtension; use Twig\TwigFunction; class TwigExtension extends AbstractExtension { /** * NEW 函數 */ public function getFunctions(): array { return [ new TwigFunction('url', [$this, 'url']), new TwigFunction('asset', [$this, 'asset']), ]; } /** * URL 方法 */ function url($url, $param = []): string { return urldecode("/" . strtolower($url) . "?" . http_build_query($param)); } /** * ASSET 方法 */ public function asset($param): string { return "/asset/" . $param; } } ~~~ ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看