本文整理匯總了PHP中Autoloader::include_dir方法的典型用法代碼示例。如果您正苦於以下問題:PHP Autoloader::include_dir方法的具體用法?PHP Autoloader::include_dir怎麽用?PHP Autoloader::include_dir使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Autoloader
的用法示例。
在下文中一共展示了Autoloader::include_dir方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: exec
public function exec($pdo_statement, $bindings = array(), $swallow_errors = false)
{
try {
WaxLog::log("info", "[DB] " . $pdo_statement->queryString);
if (count($bindings)) {
WaxLog::log("info", "[DB] Values:" . join($bindings, ","));
}
$pdo_statement->execute($bindings);
} catch (PDOException $e) {
$err = $pdo_statement->errorInfo();
switch ($e->getCode()) {
case "42S02":
case "42S22":
ob_start();
foreach (Autoloader::$plugin_array as $plugin) {
Autoloader::recursive_register(PLUGIN_DIR . $plugin["name"] . "/lib/model", "plugin", true);
}
Autoloader::include_dir(MODEL_DIR, true);
foreach (get_declared_classes() as $class) {
if (is_subclass_of($class, "WaxModel")) {
$class_obj = new $class();
$output = $class_obj->syncdb();
if (strlen($output)) {
echo $output;
}
}
}
$sync = false;
//Forces destruction and flushing of output buffer
ob_end_clean();
try {
$pdo_statement->execute($bindings);
} catch (PDOException $e) {
throw new WaxDBStructureException("{$err[2]}", "Database Structure Error", $pdo_statement->queryString . "\n" . print_r($bindings, 1));
}
break;
default:
WaxLog::log("error", "[DB] {$err['2']} , SQL: " . $pdo_statement->queryString . ($bindings ? "\n" . print_r($bindings, 1) : ""));
if (!$swallow_errors) {
throw new WaxSqlException("{$err[2]}", "Error Preparing Database Query", $pdo_statement->queryString . "\n" . print_r($bindings, 1));
}
}
}
return $pdo_statement;
}
示例2: syncdb
public function syncdb($dir = false)
{
if ($dir[1] && ($dir[1] == "test" || $dir[1] == "production")) {
define("ENV", $dir[1]);
}
$this->app_setup();
if ($dir && is_dir($dir)) {
Autoloader::include_dir($dir, true);
} else {
Autoloader::include_dir(MODEL_DIR, true);
}
foreach (get_declared_classes() as $class) {
if (is_subclass_of($class, "WaxModel")) {
$class_obj = new $class();
$output = $class_obj->syncdb();
if (strlen($output)) {
$this->add_output($output);
}
}
}
}