本文整理汇总了PHP中_404函数的典型用法代码示例。如果您正苦于以下问题:PHP _404函数的具体用法?PHP _404怎么用?PHP _404使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_404函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: start
/**
* 运行应用
* @access private
*/
private static function start()
{
//控制器实例
$control = control(CONTROL);
//控制器不存在
if (!$control) {
//空控制器
$control = Control("Empty");
if (!$control) {
_404('模块' . CONTROL . '不存在');
}
}
//执行动作
try {
$method = new ReflectionMethod($control, METHOD);
if ($method->isPublic()) {
$method->invoke($control);
} else {
throw new ReflectionException();
}
} catch (ReflectionException $e) {
$method = new ReflectionMethod($control, '__call');
$method->invokeArgs($control, array(METHOD, ''));
}
}
示例2: _outputTypeFile
function _outputTypeFile($matches)
{
$file = $matches[3];
$prefix = '';
$bits = explode("/", $file);
if (count($bits) > 1) {
$file = array_pop($bits);
$prefix = trim(implode("/", $bits), "/") . '/';
}
$platform = Kurogo::deviceClassifier()->getPlatform();
$pagetype = Kurogo::deviceClassifier()->getPagetype();
$browser = Kurogo::deviceClassifier()->getBrowser();
$testDirs = array(THEME_DIR, SHARED_THEME_DIR, SITE_APP_DIR, SHARED_APP_DIR, APP_DIR);
$testFiles = array("{$prefix}{$pagetype}-{$platform}-{$browser}/{$file}", "{$prefix}{$pagetype}-{$platform}/{$file}", "{$prefix}{$pagetype}/{$file}", "{$prefix}{$file}");
foreach ($testDirs as $dir) {
//do not assume dirs have value set
if ($dir) {
$dir .= '/' . $matches[1] . $matches[2];
foreach ($testFiles as $file) {
Kurogo::log(LOG_DEBUG, "Looking for {$dir}/{$file}", 'index');
if ($file = realpath_exists("{$dir}/{$file}")) {
_outputFile($file);
}
}
}
}
_404();
}
示例3: index
public function index()
{
$u = preg_replace('@[^\\w]@', '', Q('u'));
$pre = C('DB_PREFIX');
$sql = "SELECT uid,nickname,rname,r.rid,spec_num,credits,regtime,logintime,domain,icon FROM {$pre}user AS u\n INNER JOIN {$pre}role AS r ON u.rid=r.rid\n WHERE u.uid='{$u}' OR domain='{$u}'";
if (!($user = M()->query($sql))) {
_404('会员不存在');
}
$user = $user[0];
//--------------------------增加空间访问次数
if (!isset($_SESSION['uid']) or $_SESSION['uid'] != $user['uid']) {
$sql = "UPDATE {$pre}user SET spec_num=spec_num+1";
M()->exe($sql);
}
//---------------------------获得文章列表
$where = 'uid=' . $user['uid'] . ' AND content_state=1 ';
$db = M('content');
$count = $db->where($where)->count();
$page = new Page($count, 10);
$data = $db->where($where)->limit($page->limit())->all();
$this->data = $data;
$this->page = $page->show();
$this->user = $user;
//------------------------------获得访问数据
$guest = $this->getGuest($user['uid']);
$this->assign('guest', $guest);
$this->display();
}
示例4: start
/**
* 运行应用
* @access private
*/
private static function start()
{
//控制器实例
$control = control(CONTROL);
//控制器不存在
if (!$control) {
//应用组检测
if (IS_GROUP and !is_dir(GROUP_PATH . GROUP_NAME)) {
_404('应用组' . GROUP_PATH . GROUP_NAME . '不存在');
}
//应用检测
if (!is_dir(APP_PATH)) {
_404('应用' . APP . '不存在');
}
//空控制器
$control = Control("Empty");
if (!$control) {
_404('模块' . CONTROL . C("CONTROL_FIX") . '不存在');
}
}
//执行动作
try {
$method = new ReflectionMethod($control, METHOD);
if ($method->isPublic()) {
$method->invoke($control);
} else {
throw new ReflectionException();
}
} catch (ReflectionException $e) {
$method = new ReflectionMethod($control, '__call');
$method->invokeArgs($control, array(METHOD, ''));
}
}
示例5: category
public function category()
{
$mid = Q('mid', 0, 'intval');
$cid = Q('cid', 0, 'intval');
$cache = cache('category');
if (!$mid || !$cid || !isset($cache[$cid])) {
_404();
}
$cachetime = C('CACHE_CATEGORY') >= 1 ? C('CACHE_CATEGORY') : null;
if (!$this->isCache()) {
$category = $cache[$cid];
//外部链接,直接跳转
if ($category['cattype'] == 3) {
go($category['cat_redirecturl']);
} else {
$Model = ContentViewModel::getInstance($category['mid']);
$catid = getCategory($category['cid']);
$category['content_num'] = $Model->join()->where("cid IN(" . implode(',', $catid) . ")")->count();
$category['comment_num'] = intval(M('comment')->where("cid IN(" . implode(',', $catid) . ")")->count());
$this->assign("hdcms", $category);
$this->display($category['template'], $cachetime);
}
} else {
$this->display(null, $cachetime);
}
}
示例6: check_rem
public function check_rem()
{
//判断密码是否修改
if (!IS_AJAX) {
_404("页面错误");
}
if (!($wish = M("dm_user")->where(array('username' => $_COOKIE["username"], 'password' => $_COOKIE["password"]))->find())) {
//密码验证不成功,删除cookie
// setcookie("username",'',time()-3600,'/');
setcookie("password", '', time() - 3600, '/');
setcookie("niker", '', time() - 3600, '/');
$this->ajaxReturn(array('status' => 2), 'json');
} else {
//登录成功,存储session
M("dm_user")->where("id=" . $wish["id"])->setField("loginip", get_client_ip());
M("dm_user")->where("id=" . $wish["id"])->setField("logintime", time());
$_SESSION["username"] = $wish["username"];
$_SESSION["user_id"] = $wish["id"];
$_SESSION["niker"] = $wish["niker"];
$_SESSION["password"] = $wish["password"];
// $this->ajaxReturn(array(
// 'status'=>1,
// 'username'=>$_COOKIE["username"],
// 'password'=>$_COOKIE["password"],
// 'niker'=>$_COOKIE["niker"],
// ),'json');
}
}
示例7: show
function show()
{
$docs = _class('docs');
$dir = $docs->docs_dir;
$dir_len = strlen($dir);
$ext = '.stpl';
$ext_len = strlen($ext);
$name = preg_replace('~[^a-z0-9/_-]+~ims', '', $_GET['id']);
if (strlen($name)) {
$dev_path = YF_PATH . '.dev/samples/classes/';
$dev_class_path = $dev_path . $name . '.class.php';
if (file_exists($dev_class_path)) {
return _class($name, $dev_path)->show();
}
$f = $dir . $name . '.stpl';
if (!file_exists($f)) {
return _404('Not found');
}
return '<section class="page-contents">' . tpl()->parse_string(file_get_contents($f), $replace, 'doc_' . $name) . '</section>';
}
$url = rtrim(url('/@object/@action/')) . '/';
$data = [];
foreach ((array) $this->_get_misc_docs($dir) as $name) {
$data[$name] = ['name' => $name, 'link' => $url . urlencode($name)];
}
ksort($data);
return html()->li($data);
}
示例8: start
/**
* 运行应用
* @access private
*/
private static function start()
{
//控制器实例
$controller = controller(CONTROLLER);
//控制器不存在
if (!$controller) {
//模块检测
if (!is_dir(MODULE_PATH)) {
_404('模块' . MODULE . '不存在');
}
//空控制器
$controller = Controller("Empty");
if (!$controller) {
_404('控制器' . CONTROLLER . C("CONTROLLER_FIX") . '不存在');
}
}
//执行动作
try {
$action = new ReflectionMethod($controller, ACTION);
if ($action->isPublic()) {
$action->invoke($controller);
} else {
throw new ReflectionException();
}
} catch (ReflectionException $e) {
$action = new ReflectionMethod($controller, '__call');
$action->invokeArgs($controller, array(ACTION, ''));
}
}
示例9: login
public function login()
{
if (!IS_POST) {
_404('页面不存在');
}
/*if(I('code', '', 'md5') != session('verify')){
$this->error('验证码错误');
}*/
$username = I('username');
$pwd = I('password', '', 'md5');
$user = M('user')->where(array('username' => $username))->find();
if (!$user || $user['password'] != $pwd) {
$this->error('账号或密码错误');
} else {
if ($user['lock']) {
$this->error('用户被锁定');
}
}
//更新数据库
$data = array('id' => $user['id'], 'loginTime' => time(), 'loginIp' => get_client_ip());
M('user')->save($data);
//读取权限
session(C('USER_AUTH_KEY'), $user['id']);
session('username', $user['username']);
session('loginTime', date('y-m-d H:i:s'), $user['loginTime']);
session('loginIp', $user['loginIp']);
if ($user['username'] == C('RBAC_SUPERADMIN')) {
session(C('ADMIN_AUTH_KEY'), true);
}
import('ORG.Util.RBAC');
RBAC::saveAccessList();
//P($_SESSION);
//die();
$this->redirect('Admin/Index/index');
}
示例10: __init
public function __init()
{
$this->_db = K("Comment");
$this->_mid = Q('mid', null, 'intval');
$this->_cid = Q('cid', null, 'intval');
$this->_aid = Q('aid', null, 'intval');
//栏目与文章aid必须存在
if (!$this->_cid || !$this->_aid) {
_404('参数错误');
}
}
示例11: _empty
public function _empty()
{
$a = ACTION_NAME;
$id = intval($_REQUEST['id']);
$m = MODULE_NAME;
$bae = new BaseAction();
if (!method_exists($bae, $a)) {
_404('404');
}
$bae->{$a}($id, $m);
}
示例12: handle
public function handle()
{
if (!IS_POST) {
_404('非法操作,请重试', U('index'));
}
$data = array('username' => I('username', '', 'htmlspecialchars'), 'content' => I('content', '', 'htmlspecialchars'), 'time' => time());
if (M('wish')->data($data)->add()) {
$this->success('恭喜你提交成功', U('index'));
} else {
$this->error('提交失败,请重试。');
}
}
示例13: show
function show()
{
$docs = _class('docs');
$dir = $docs->demo_dir;
$dir_len = strlen($dir);
$ext = '.php';
$ext_len = strlen($ext);
$names = $this->_get_demos($dir);
ksort($names);
$name = preg_replace('~[^a-z0-9/_-]+~ims', '', $_GET['id']);
if (strlen($name)) {
$f = $dir . $name . '.php';
if (!file_exists($f)) {
return _404('Not found');
}
$body = (include $f);
if (is_callable($body)) {
$self_source = _class('core_api')->get_function_source($body);
$body = $body();
} else {
$self_source = ['name' => $name, 'file' => $f, 'line_start' => 1, 'source' => $body];
}
$prev = '';
$next = '';
$i = 0;
foreach ((array) $names as $_name) {
if ($name !== $_name) {
$prev = $_name;
} elseif ($name === $_name) {
$next = current(array_slice($names, $i + 1, 1));
break;
}
$i++;
}
$name_html = preg_replace('~[^0-9a-z_-]~ims', '', $name);
$header = '<div id="head_' . $name_html . '" class="panel">
<div class="panel-heading">
<h1 class="panel-title">
<a href="' . url('/@object/@action/' . urlencode($name)) . '">' . $name . '</a>
<div class="pull-right">' . _class('core_api')->_github_link_btn($self_source) . '<button class="btn btn-primary btn-xs" data-toggle="collapse" data-target="#func_self_source_' . $name_html . '"><i class="fa fa-file-text-o"></i> source</button> ' . ($prev ? '<a href="' . url('/@object/@action/' . urlencode($prev)) . '" class="btn btn-primary btn-xs"><</a> ' : '') . ($next ? '<a href="' . url('/@object/@action/' . urlencode($next)) . '" class="btn btn-primary btn-xs">></a> ' : '') . '</div>
</h1>
</div>
<div id="func_self_source_' . $name_html . '" class="panel-body collapse out"><pre class="prettyprint lang-php"><code>' . _prepare_html($self_source['source']) . '</code></pre></div> ' . ($target_source['source'] ? '<div id="func_target_source_' . $name_html . '" class="panel-body collapse out"><pre class="prettyprint lang-php"><code>' . _prepare_html($target_source['source']) . '</code></pre></div> ' : '') . '</div>';
return implode(PHP_EOL, [$header, '<section class="page-contents">' . tpl()->parse_string($body, $replace, 'demo_' . $name) . '</section>']);
}
$url = rtrim(url('/@object/@action/')) . '/';
$data = [];
foreach ((array) $names as $name) {
$data[$name] = ['name' => $name, 'link' => $url . urlencode($name)];
}
ksort($data);
return html()->li($data);
}
示例14: edit
/**
*/
function edit()
{
$a = $this->_get_info();
if (!$a) {
return _404();
}
$a['back_link'] = url('/@object');
$_this = $this;
return form((array) $_POST + (array) $a)->validate(['__before__' => 'trim', 'name' => 'required', 'text' => 'required'])->update_if_ok(self::table, ['name', 'text', 'active', 'locale'])->on_before_update(function () use($a, $_this) {
module_safe('manage_revisions')->add(['object_name' => $_this::table, 'object_id' => $a['id'], 'old' => $a, 'new' => $_POST, 'action' => 'update']);
})->container($this->_get_lang_links($a['locale'], $a['name'], 'edit'))->text('name')->textarea('text', ['id' => 'text', 'cols' => 200, 'rows' => 10, 'ckeditor' => ['config' => _class('admin_methods')->_get_cke_config()]])->active_box()->save_and_back();
}
示例15: _outputFileLoaderFile
function _outputFileLoaderFile($matches) {
$fullPath = FileLoader::load($matches[1]);
if ($fullPath) {
CacheHeaders($fullPath);
header('Content-type: '.mime_type($fullPath));
echo file_get_contents($fullPath);
exit;
}
_404();
}