當前位置: 首頁>>代碼示例>>PHP>>正文


PHP R::setAutoResolve方法代碼示例

本文整理匯總了PHP中RedBeanPHP\R::setAutoResolve方法的典型用法代碼示例。如果您正苦於以下問題:PHP R::setAutoResolve方法的具體用法?PHP R::setAutoResolve怎麽用?PHP R::setAutoResolve使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在RedBeanPHP\R的用法示例。


在下文中一共展示了R::setAutoResolve方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: register

 public function register(Container $c)
 {
     $settings = $c["settings"];
     $options = ['dsn' => null, 'username' => null, 'password' => null, 'frozen' => false];
     if (isset($settings["redbean.setup"])) {
         $options = array_merge($options, $settings["redbean.setup"]);
     }
     $c["redbean"] = R::setup($options["dns"], $options["username"], $options["password"], $options["frozen"]);
     $c["redbean.helper"] = new \CodePasha\RedBean\Support\RedBeanHelper();
     R::getRedBean()->setBeanHelper($c["redbean.helper"]);
     R::setAutoResolve(true);
 }
開發者ID:MhmdLab,項目名稱:redbean-slim,代碼行數:12,代碼來源:RedBeanServiceProvider.php

示例2: setDb

 /**
  * @param $name
  * @return mixed
  */
 public function setDb($name)
 {
     $this->options = $this->db[$name];
     R::setAutoResolve(TRUE);
     R::selectDatabase($name);
     R::ext('xdispense', function ($type) {
         return R::getRedBean()->dispense($type);
     });
     if ($this->cache) {
         R::useWriterCache(true);
         R::freeze(TRUE);
     }
     return $name;
 }
開發者ID:jetfirephp,項目名稱:db,代碼行數:18,代碼來源:RedBeanConstructor.php

示例3: exceptionHandler

require_once 'helpers.php';
// Must come after $jsonResponse exists.
// Catch Exception if connection to DB failed
function exceptionHandler($exception)
{
    global $jsonResponse;
    header('Content-Type: application/json');
    http_response_code(503);
    $jsonResponse->message = 'API Error.';
    $jsonResponse->data = $exception->getMessage();
    $jsonResponse->trace = $exception->getTrace();
    echo $jsonResponse->asJson();
}
set_exception_handler('exceptionHandler');
R::setup('sqlite:' . __DIR__ . '/taskboard.db');
R::setAutoResolve(TRUE);
createInitialUser();
$app->notFound(function () use($app, $jsonResponse) {
    $app->response->setStatus(404);
    $jsonResponse->message = 'Matching API call Not found.';
    $app->response->setBody($jsonResponse->asJson());
});
$app->get('/authenticate', function () use($app, $jsonResponse) {
    if (validateToken()) {
        $jsonResponse->message = 'Token is authenticated.';
    }
    $app->response->setBody($jsonResponse->asJson());
});
require_once 'mailFactory.php';
require_once 'userRoutes.php';
require_once 'boardRoutes.php';
開發者ID:priestd09,項目名稱:TaskBoard,代碼行數:31,代碼來源:api.php


注:本文中的RedBeanPHP\R::setAutoResolve方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。