本文整理汇总了PHP中Error::getError方法的典型用法代码示例。如果您正苦于以下问题:PHP Error::getError方法的具体用法?PHP Error::getError怎么用?PHP Error::getError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Error
的用法示例。
在下文中一共展示了Error::getError方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getHtmlBegin
public static function getHtmlBegin($targetRoute = false, $formName = 'form', $showErrors = false)
{
$html = '<form method="post" name="' . $formName . '" >';
// $html .= '<input type="hidden" name="formRoute" value="'.$targetRoute.'" />';
if ($showErrors) {
$error = Error::getError();
$html .= $error;
}
return $html;
}
示例2: foreach
/* load db config settings into constants */
$db = Database::getDatabase();
$rows = $db->getRows("SELECT config_key, config_value FROM site_config ORDER BY config_group, config_key");
if (COUNT($rows)) {
foreach ($rows as $row) {
$constantName = "SITE_CONFIG_" . strtoupper($row['config_key']);
define($constantName, $row['config_value']);
}
}
/* setup translations */
translate::setUpTranslationConstants();
// Store session info in the database?
if ($Config->useDBSessions === true) {
DBSession::register();
}
// Initialize our session
session_name($Config->sessionName);
session_start();
// Initialize current user
$Auth = Auth::getAuth();
// Object for tracking and displaying error messages
$Error = Error::getError();
define("SITE_IMAGE_PATH", WEB_ROOT . "/themes/" . SITE_CONFIG_SITE_THEME . "/images");
define("SITE_CSS_PATH", WEB_ROOT . "/themes/" . SITE_CONFIG_SITE_THEME . "/styles");
define("SITE_JS_PATH", WEB_ROOT . "/themes/" . SITE_CONFIG_SITE_THEME . "/js");
/* check for banned ip */
$bannedIP = bannedIP::getBannedType();
if (strtolower($bannedIP) == "whole site") {
header('HTTP/1.1 404 Not Found');
die;
}
示例3: runController
/**
* 启动控制器
*
*/
public function runController()
{
$cBuilder = Imp::app()->instance('mvcBuilder')->controllerBuilder();
$cBuilder->init();
$cFile = $cBuilder->file();
$cName = $cBuilder->controller();
$cAction = $cBuilder->action();
$cParams = $cBuilder->params();
$config = Imp::app()->instance('config')->get();
if (!is_file($cFile)) {
if ($config['debug']) {
CError::show("Controller file \"<font color=\"red\">{$cFile}</font>\" not found");
} else {
View::show404();
}
return;
}
// 应用基类
$myController = Imp::app()->basePath() . '/MyController/BaseController.php';
if (is_file($myController)) {
require $myController;
}
require $cFile;
if (!class_exists($cName)) {
if ($config['debug']) {
Error::show(Error::getError(Error::$errorType['no_controller']) . ': ' . $cName);
} else {
View::show404();
}
}
// 检查最终的控制器及其方法
if (!method_exists($cName, $cAction)) {
Imp::app()->instance('router')->unShiftParams($cAction);
$cAction = Imp::app()->instance('config')->get('default_action');
$cParams = Imp::app()->instance('router')->getParams();
Imp::app()->instance('router')->setAction($cAction);
}
// action 钩子
Imp::app()->instance('hook')->call('action');
// 实例化操作模块
$cInstance = new $cName();
// 检查最终的控制器及其方法
if (!method_exists($cInstance, $cAction)) {
if ($config['debug']) {
Error::show(Error::getError(Error::$errorType['no_action']) . ': ' . $cAction);
} else {
View::show404();
}
return;
}
// 调用当前控制器方法
call_user_func_array(array($cInstance, $cAction), $cParams);
}
示例4: strtoupper
</thead>
<?php
for ($i = 0; $i < count($bests); $i++) {
echo '<tr>';
echo '<td>' . $bests[$i]['year'] . '/' . strtoupper($bests[$i]['class']) . '</td>';
echo '<td>' . $bests[$i]['name'] . '</td>';
echo '</tr>';
}
?>
</table>
</div>
<div class="clear"></div>
</div>
</div>
<?php
} else {
$error = new Error(100);
?>
<div class="panel panel-default fault-msg">
<div class="panel-body">
<?php
echo $error->getError();
?>
</div>
</div>
<?php
}
?>
</body>
</html>
示例5: execute
/**
* Page::create()
*
* @return
*/
public function execute()
{
$this->_generating = true;
if ($this->getStatus() != 200) {
if ($this->parent->user->is_loggedIn() && $this->getStatus() == 401) {
$this->setStatus(403);
}
if (!$this->parent->user->is_loggedIn() && WebApp::get('cat1') === 'admin') {
$this->setStatus(404);
}
}
require_once __MODULE__ . '/core/controller.php';
$coreController = new CorePageController($this);
$this->parent->debug($this::name_space . ': Page title is "' . $this->getTitle() . '"');
$this->parent->debug($this::name_space . ': Getting page header');
$page = $coreController->getHeader($this);
$this->parent->debug($this::name_space . ': Getting navbar');
$page .= $coreController->getNavBar($this);
$this->parent->debug($this::name_space . ': Getting status bar');
$page .= $coreController->getStatusBar($this);
if ($this->getStatus() == 200) {
$this->parent->debug($this::name_space . ': Getting page content');
$page .= $this->content;
} else {
$this->parent->debug($this::name_space . ': Generating error message');
$error = new Error($this, $this->getStatus());
$page .= $error->getError();
}
$page .= '</div>' . PHP_EOL;
$this->parent->debug($this::name_space . ': Getting page footer');
$page .= $coreController->getFooter($this);
$this->_generating = false;
$this->parent->debug($this::name_space . ': Page created!');
$this->parent->content = $page;
if ($this->_regen) {
$this->parent->debug($this::name_space . ': Regenerating page... something changed whilst creating the page');
$this->_regen = false;
$this->execute();
}
}
示例6:
<!-- views\ login php -->
<div class="col-md-6">
<form method="POST">
<div class="col-md-3">
Логин
<input type="text" name="login" />
</div>
</div>
<div class="col-md-6">
<div class="col-md-3">
Пароль
<input type="text" name="password" />
</div>
</div>
<br />
<div class="col-md-6">
<div class="col-md-3">
<button type="submit">Войти</button>
</div>
</form>
<?php
if (Error::getError()) {
?>
<p style="color: red;"><?php
echo Error::getError();
?>
</p>
<?php
}
?>
</div>
示例7: getRenderFile
/**
* 视图文件
*
* @param string $file
* @return string
*/
public function getRenderFile($file = null)
{
if (empty($file)) {
$file = Imp::app()->instance('mvcBuilder')->viewBuilder()->file();
} else {
$file = Imp::app()->instance('mvcBuilder')->viewBuilder()->getRenderFile($file);
}
if (!is_file($file)) {
Error::show(Error::getError(Error::$errorType['no_view_file']) . ': ' . $file);
return;
}
return $file;
}