<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>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                [TOC] 如果您發現了錯誤,請務必在您的問題中添加相關的可重現性信息,以便我們重現錯誤并更快地修復錯誤。如果您在Github上公開申請,請提交存儲庫地址以及問題說明。您還可以使用 [Gist](https://gist.github.com/) 發布您想要與我們分享的任何代碼。 ## 創建一個小腳本 一個小的單文件腳本通常是重現問題的最佳方法: ```php <?php $di = new Phalcon\DI\FactoryDefault(); //Register your custom services $di['session'] = function() { $session = new \Phalcon\Session\Adapter\Files(); $session->start(); return $session; }; $di['cookies'] = function() { $cookies = new Phalcon\Http\Response\Cookies(); $cookies->useEncryption(false); return $cookies; }; class SomeClass extends \Phalcon\DI\Injectable { public function someMethod() { $cookies = $this->getDI()->getCookies(); $cookies->set("mycookie", "test", time() + 3600, "/"); } } $c = new MyClass; $c->setDI($di); $c->someMethod(); $di['cookies']->send(); var_dump($_SESSION); var_dump($_COOKIE); ``` 根據您的應用程序,您可以使用這些框架來創建自己的腳本并重現該錯誤: ### 數據庫 請記住向腳本添加如何注冊數據庫服務: ```php <?php $di = new Phalcon\DI\FactoryDefault(); $di->setShared('db', function () { return new \Phalcon\Db\Adapter\PDO\Mysql(array( 'host' => '127.0.0.1', 'username' => 'root', 'password' => '', 'dbname' => 'test', 'charset' => 'utf8', )); }); $result = $di['db']->query('SELECT * FROM customers'); ``` ### 單/多模塊應用 請記住向腳本添加如何創建 `Phalcon\Mvc\Application` 實例: ```php <?php $di = new \Phalcon\DI\FactoryDefault(); //other services $app = new \Phalcon\Mvc\Application(); $app->setDi($di); //register modules if any echo $app->handle->getContent() ``` 包括模型和控制器作為測試的一部分: ```php <?php $di = new \Phalcon\DI\FactoryDefault(); //other services $app = new \Phalcon\Mvc\Application(); $app->setDi($di); class IndexController extends Phalcon\Mvc\Controller { public function indexAction() { /* your content here */ } } class Users extends Phalcon\Mvc\Model { } echo $app->handle->getContent() ``` ### 微應用 按照此結構創建腳本: ```php <?php $di = new \Phalcon\DI\FactoryDefault(); $app = new \Phalcon\Mvc\Micro($di); //define your routes here $app->handle(); ``` ### Dispatcher ### ORM 您可以提供自己的數據庫模式,甚至可以更好地使用任何phalcon測試[數據庫](https://github.com/phalcon/cphalcon/tree/master/unit-tests/schemas)。按照此結構創建腳本: ```php <?php use Phalcon\DI; use Phalcon\Events\Manager as EventsManager; use Phalcon\Db\Adapter\Pdo\Mysql as Connection; use Phalcon\Mvc\Model\Manager as ModelsManager; use Phalcon\Mvc\Model\Metadata\Memory as ModelsMetaData; $eventsManager = new EventsManager(); $di = new DI(); $connection = new Connection(array( "host" => "localhost", "username" => "root", "password" => "", "dbname" => "test" )); $connection->setEventsManager($eventsManager); $eventsManager->attach('db', function ($event, $connection) { switch ($event->getType()) { case 'beforeQuery': echo $connection->getSqlStatement(), "<br>\n"; break; } } ); $di['db'] = $connection; $di['modelsManager'] = new ModelsManager(); $di['modelsMetadata'] = new ModelsMetadata(); if (!$connection->tableExists('user', 'test')) { $connection->execute('CREATE TABLE user (id integer primary key auto_increment, email varchar(120) not null)'); } class User extends \Phalcon\Mvc\Model { public $id; public $email; public static function myCustomUserCreator() { $newUser = new User(); $newUser->email = 'test'; if ($newUser->save() == false) { return false; } return $newUser->id; } } echo User::myCustomUserCreator(); ```
                  <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>

                              哎呀哎呀视频在线观看