本文整理汇总了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);
}
}
}
}