<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之旅 廣告
                > 視圖組件由 hyperf/view 實現并提供使用,滿足您對視圖渲染的需求,組件默認支持 Blade 、 Smarty 、 Twig 、 Plates 和 ThinkTemplate 五種模板引擎 [TOC] ## 安裝 ~~~ # 安裝視圖基礎庫 composer require hyperf/view # 安裝blade視圖引擎 composer require duncan3dc/blade ~~~ ## 配置支持視圖 > 視圖渲染引擎選擇Blade,配置文件:/config/autoload/view.php > 視圖下默認是使用Task 運行模式,Controller則默認為Coroutine 運行模式 ~~~ declare(strict_types=1); use Hyperf\View\Mode; use Hyperf\View\Engine\BladeEngine; return [ // 使用的渲染引擎 'engine' => BladeEngine::class, // 不填寫則默認為 Task 模式,推薦使用 Task 模式 'mode' => Mode::TASK, 'config' => [ // 若下列文件夾不存在請自行創建 'view_path' => BASE_PATH . '/view/', 'cache_path' => BASE_PATH . '/runtime/view/', ], ]; ~~~ ## 安裝 Task ### 安裝組件 ~~~ composer require hyperf/task ~~~ ### 配置 Task > 配置文件:/config/autoload/server.php ~~~ declare(strict_types=1); use Hyperf\Server\SwooleEvent; return [ // 這里省略了其它不相關的配置項 'settings' => [ // Task Worker 數量,根據您的服務器配置而配置適當的數量 'task_worker_num' => 8, // 因為 `Task` 主要處理無法協程化的方法,所以這里推薦設為 `false`,避免協程下出現數據混淆的情況 'task_enable_coroutine' => false, ], 'callbacks' => [ // Task callbacks SwooleEvent::ON_TASK => [Hyperf\Framework\Bootstrap\TaskCallback::class, 'onTask'], SwooleEvent::ON_FINISH => [Hyperf\Framework\Bootstrap\FinishCallback::class, 'onFinish'], ], ]; ~~~ ## 配置靜態資源 > 如果您希望 Swoole 來管理靜態資源,請在 /config/autoload/server.php 配置中增加以下配置 > 根目錄下創建 /public/images 和 /publis/css ~~~ return [ 'settings' => [ ... // 靜態資源 'document_root' => BASE_PATH . '/public', 'static_handler_locations' => ['/images', '/css'], 'enable_static_handler' => true, ], ]; ~~~ ## 使用測試 ### Controller ~~~ declare(strict_types=1); namespace App\Controller; use Hyperf\HttpServer\Annotation\AutoController; use Hyperf\View\RenderInterface; /** * @AutoController */ class ViewController { public function index(RenderInterface $render) { return $render->render('index', ['name' => 'wkkkk']); } } ~~~ ### view ~~~ <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Hyperf</title> </head> <body> Hello, {{ $name }}. You are using blade template now. <img src="/images/1.jpg" width="50" /> </body> </html> ~~~
                  <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>

                              哎呀哎呀视频在线观看