• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP baseUrl函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中baseUrl函数的典型用法代码示例。如果您正苦于以下问题:PHP baseUrl函数的具体用法?PHP baseUrl怎么用?PHP baseUrl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了baseUrl函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: authenticated

 /**
  * Overrides the action when a user is authenticated.
  * If the user authenticated but does not exist in the user table we create them.
  * @param Request $request
  * @param Authenticatable $user
  * @return \Illuminate\Http\RedirectResponse
  * @throws AuthException
  */
 protected function authenticated(Request $request, Authenticatable $user)
 {
     // Explicitly log them out for now if they do no exist.
     if (!$user->exists) {
         auth()->logout($user);
     }
     if (!$user->exists && $user->email === null && !$request->has('email')) {
         $request->flash();
         session()->flash('request-email', true);
         return redirect('/login');
     }
     if (!$user->exists && $user->email === null && $request->has('email')) {
         $user->email = $request->get('email');
     }
     if (!$user->exists) {
         // Check for users with same email already
         $alreadyUser = $user->newQuery()->where('email', '=', $user->email)->count() > 0;
         if ($alreadyUser) {
             throw new AuthException('A user with the email ' . $user->email . ' already exists but with different credentials.');
         }
         $user->save();
         $this->userRepo->attachDefaultRole($user);
         auth()->login($user);
     }
     $path = session()->pull('url.intended', '/');
     $path = baseUrl($path, true);
     return redirect($path);
 }
开发者ID:ssddanbrown,项目名称:bookstack,代码行数:36,代码来源:LoginController.php


示例2: url

/**
 * @param $path
 * @return string
 */
function url($path)
{
    if (substr($path, 0, 1) === '/') {
        $path = substr($path, 1);
    }
    return baseUrl() . $path;
}
开发者ID:kxopa,项目名称:slim-boilerplate,代码行数:11,代码来源:SlimHelpers.php


示例3: getUrl

 /**
  * Get the url for this book.
  * @param string|bool $path
  * @return string
  */
 public function getUrl($path = false)
 {
     if ($path !== false) {
         return baseUrl('/books/' . urlencode($this->slug) . '/' . trim($path, '/'));
     }
     return baseUrl('/books/' . urlencode($this->slug));
 }
开发者ID:ssddanbrown,项目名称:bookstack,代码行数:12,代码来源:Book.php


示例4: getUrl

 /**
  * Get the url of this chapter.
  * @param string|bool $path
  * @return string
  */
 public function getUrl($path = false)
 {
     $bookSlug = $this->getAttribute('bookSlug') ? $this->getAttribute('bookSlug') : $this->book->slug;
     if ($path !== false) {
         return baseUrl('/books/' . urlencode($bookSlug) . '/chapter/' . urlencode($this->slug) . '/' . trim($path, '/'));
     }
     return baseUrl('/books/' . urlencode($bookSlug) . '/chapter/' . urlencode($this->slug));
 }
开发者ID:ssddanbrown,项目名称:bookstack,代码行数:13,代码来源:Chapter.php


示例5: fixFolderPaths

function fixFolderPaths($content)
{
    $fixed_content = '';
    if (strlen(strstr($content, baseUrl())) > 0) {
        $fixed_content = str_replace(baseUrl() . '/', 'files/', $content);
    } else {
        $fixed_content = $content;
    }
    return $fixed_content;
}
开发者ID:hscale,项目名称:SiteZilla,代码行数:10,代码来源:download_functions.php


示例6: u

function u($uri, $options = array())
{
    $base = baseUrl();
    if (0 !== strpos($uri, 'http') && 0 !== strpos($uri, '/')) {
        if (@$options['absolute']) {
            $uri = 'http://' . $_SERVER['HTTP_HOST'] . $uri;
        }
    }
    return $uri;
}
开发者ID:rudiedirkx,项目名称:Blogs-feed,代码行数:10,代码来源:inc.tpl.php


示例7: __construct

 /**
  * Create a new controller instance.
  *
  * @param SocialAuthService $socialAuthService
  * @param EmailConfirmationService $emailConfirmationService
  * @param UserRepo $userRepo
  */
 public function __construct(SocialAuthService $socialAuthService, EmailConfirmationService $emailConfirmationService, UserRepo $userRepo)
 {
     $this->middleware('guest')->except(['socialCallback', 'detachSocialAccount']);
     $this->socialAuthService = $socialAuthService;
     $this->emailConfirmationService = $emailConfirmationService;
     $this->userRepo = $userRepo;
     $this->redirectTo = baseUrl('/');
     $this->redirectPath = baseUrl('/');
     parent::__construct();
 }
开发者ID:ssddanbrown,项目名称:bookstack,代码行数:17,代码来源:RegisterController.php


示例8: addJs

 public static function addJs($js, $callback = '')
 {
     if (strpos($js, 'http') === false) {
         $js = baseUrl() . $js;
     }
     static::$template_vars['js'][] = $js;
     if ($callback) {
         static::$template_vars['jsCallback'][$js] = $callback;
     }
 }
开发者ID:kxopa,项目名称:slim-boilerplate,代码行数:10,代码来源:LayoutView.php


示例9: auto

 /**
  * 可以设置,自动过滤的内容
  */
 private function auto()
 {
     if (baseUrl(0) == __CLASS__) {
         die;
     }
     $ip = array('188.0.0.1');
     $refer = array('http://127.0.0.1');
     $this->frequency(8)->refer($refer);
     return $this;
 }
开发者ID:highestgoodlikewater,项目名称:spider-3,代码行数:13,代码来源:base.php


示例10: getUrl

 /**
  * Get the url for this page.
  * @param string|bool $path
  * @return string
  */
 public function getUrl($path = false)
 {
     $bookSlug = $this->getAttribute('bookSlug') ? $this->getAttribute('bookSlug') : $this->book->slug;
     $midText = $this->draft ? '/draft/' : '/page/';
     $idComponent = $this->draft ? $this->id : urlencode($this->slug);
     if ($path !== false) {
         return baseUrl('/books/' . urlencode($bookSlug) . $midText . $idComponent . '/' . trim($path, '/'));
     }
     return baseUrl('/books/' . urlencode($bookSlug) . $midText . $idComponent);
 }
开发者ID:ssddanbrown,项目名称:bookstack,代码行数:15,代码来源:Page.php


示例11: handle

 /**
  * Handle an incoming request.
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->check() && setting('registration-confirmation') && !$this->auth->user()->email_confirmed) {
         return redirect(baseUrl('/register/confirm/awaiting'));
     }
     if ($this->auth->guest() && !setting('app-public')) {
         if ($request->ajax()) {
             return response('Unauthorized.', 401);
         } else {
             return redirect()->guest(baseUrl('/login'));
         }
     }
     return $next($request);
 }
开发者ID:ssddanbrown,项目名称:bookstack,代码行数:20,代码来源:Authenticate.php


示例12: upload

 /**
  * 监视本地文件上传, $name为文件表单名,可发送单独POST['name']定义存储文件名
  */
 function upload($name, $storName = null)
 {
     $ret = $this->commonCheck($name, $storName);
     if ($ret['code'] == 0) {
         $destination = self::$uploadDir . date('Ymd');
         if (!is_readable($destination)) {
             is_file($destination) or mkdir($destination, 0700);
         }
         $destination = $destination . '/' . $ret['msg'];
         move_uploaded_file($_FILES[$name]['tmp_name'], $destination);
         $ret['msg'] = baseUrl($destination);
         return $ret;
     }
     return $ret;
 }
开发者ID:highestgoodlikewater,项目名称:spider-3,代码行数:18,代码来源:uploader.class.php


示例13: register

 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     Paginator::viewFactoryResolver(function () {
         return $this->app['view'];
     });
     Paginator::currentPathResolver(function () {
         return baseUrl($this->app['request']->path());
     });
     Paginator::currentPageResolver(function ($pageName = 'page') {
         $page = $this->app['request']->input($pageName);
         if (filter_var($page, FILTER_VALIDATE_INT) !== false && (int) $page >= 1) {
             return $page;
         }
         return 1;
     });
 }
开发者ID:ssddanbrown,项目名称:bookstack,代码行数:21,代码来源:PaginationServiceProvider.php


示例14: use

 public function use(string $randomPageVariable, array $randomDataVariable = NULL, bool $randomObGetContentsVariable = false)
 {
     if (!empty(Properties::$parameters['usable'])) {
         $randomObGetContentsVariable = Properties::$parameters['usable'];
     }
     if (!empty(Properties::$parameters['data'])) {
         $randomDataVariable = Properties::$parameters['data'];
     }
     Properties::$parameters = [];
     $eol = EOL;
     $randomPageVariableExtension = extension($randomPageVariable);
     $randomPageVariableBaseUrl = baseUrl($randomPageVariable);
     $return = '';
     if (!is_file($randomPageVariable)) {
         throw new InvalidArgumentException('Error', 'fileParameter', '1.($randomPageVariable)');
     }
     if ($randomPageVariableExtension === 'js') {
         $return = '<script type="text/javascript" src="' . $randomPageVariableBaseUrl . '"></script>' . $eol;
     } elseif ($randomPageVariableExtension === 'css') {
         $return = '<link href="' . $randomPageVariableBaseUrl . '" rel="stylesheet" type="text/css" />' . $eol;
     } elseif (stristr('svg|woff|otf|ttf|' . implode('|', Config::get('ViewObjects', 'font')['differentFontExtensions']), $randomPageVariableExtension)) {
         $return = '<style type="text/css">@font-face{font-family:"' . divide(removeExtension($randomPageVariable), "/", -1) . '"; src:url("' . $randomPageVariableBaseUrl . '") format("truetype")}</style>' . $eol;
     } elseif ($randomPageVariableExtension === 'eot') {
         $return = '<style type="text/css"><!--[if IE]>@font-face{font-family:"' . divide(removeExtension($randomPageVariable), "/", -1) . '"; src:url("' . $randomPageVariableBaseUrl . '") format("truetype")}<![endif]--></style>' . $eol;
     } else {
         $randomPageVariable = suffix($randomPageVariable, '.php');
         if (is_file($randomPageVariable)) {
             if (is_array($randomDataVariable)) {
                 extract($randomDataVariable, EXTR_OVERWRITE, 'zn');
             }
             if ($randomObGetContentsVariable === false) {
                 require $randomPageVariable;
             } else {
                 ob_start();
                 require $randomPageVariable;
                 $randomSomethingFileContent = ob_get_contents();
                 ob_end_clean();
                 return $randomSomethingFileContent;
             }
         }
     }
     if ($randomObGetContentsVariable === false) {
         echo $return;
     } else {
         return $return;
     }
 }
开发者ID:znframework,项目名称:znframework,代码行数:47,代码来源:Something.php


示例15: afterLayout

 /**
  * afterLayout
  *
  * @return void
  * @access public
  */
 function afterLayout()
 {
     /* 出力データをSJISに変換 */
     $view =& ClassRegistry::getObject('view');
     if (isset($this->params['url']['ext']) && $this->params['url']['ext'] == 'rss') {
         $rss = true;
     } else {
         $rss = false;
     }
     if ($view && !$rss && Configure::read('AgentPrefix.currentAgent') == 'mobile' && $view->layoutPath != 'email' . DS . 'text') {
         $view->output = str_replace('&', '&amp;', $view->output);
         $view->output = str_replace('<', '&lt;', $view->output);
         $view->output = str_replace('>', '&gt;', $view->output);
         $view->output = mb_convert_kana($view->output, "rak", "UTF-8");
         $view->output = mb_convert_encoding($view->output, "SJIS-win", "UTF-8");
         // 内部リンクの自動変換
         $currentAlias = Configure::read('AgentPrefix.currentAlias');
         $baseUrl = baseUrl();
         $view->output = preg_replace('/href=\\"' . str_replace('/', '\\/', $baseUrl) . '([^\\"]+?)\\"/', "href=\"" . $baseUrl . $currentAlias . "/\$1\"", $view->output);
         $view->output = preg_replace('/href=\\"' . str_replace('/', '\\/', $baseUrl) . $currentAlias . '\\/' . $currentAlias . '\\//', "href=\"" . $baseUrl . $currentAlias . "/", $view->output);
         // 変換した上キャッシュを再保存しないとキャッシュ利用時に文字化けしてしまう
         $caching = isset($view->loaded['cache']) && $view->cacheAction != false && Configure::read('Cache.check') === true;
         if ($caching) {
             if (is_a($view->loaded['cache'], 'CacheHelper')) {
                 $cache =& $view->loaded['cache'];
                 $cache->base = $view->base;
                 $cache->here = $view->here;
                 $cache->helpers = $view->helpers;
                 $cache->action = $view->action;
                 $cache->controllerName = $view->name;
                 $cache->layout = $view->layout;
                 $cache->cacheAction = $view->cacheAction;
                 $cache->cache($___viewFn, $view->output, true);
             }
         } else {
             // nocache で コンテンツヘッダを出力する場合、逆にキャッシュを利用しない場合に、
             // nocache タグが残ってしまってエラーになるので除去する
             $view->output = str_replace('<cake:nocache>', '', $view->output);
             $view->output = str_replace('</cake:nocache>', '', $view->output);
         }
         // XMLとして出力する場合、デバッグモードで出力する付加情報で、
         // ブラウザによってはXMLパースエラーとなってしまうので強制的にデバッグモードをオフ
         Configure::write('debug', 0);
     }
 }
开发者ID:nojimage,项目名称:basercms,代码行数:51,代码来源:mobile.php


示例16: js

 function js($path, $fileName = '')
 {
     $result = "";
     if (empty($fileName)) {
         $temp = removeMultiple(baseUrl() . "/Resources/" . $path);
         return removeMultiple('<script type="text/javascript" src="' . $temp . '"></script>') . PHP_EOL;
     } else {
         if (is_array($fileName)) {
             foreach ($fileName as $file) {
                 $temp = removeMultiple(baseUrl() . "/Resources/" . $path . "/" . $file);
                 $result .= '<script type="text/javascript" src="' . $temp . '"></script>' . PHP_EOL;
             }
             return $result;
         } else {
             $temp = removeMultiple(baseUrl() . "/Resources/" . $path . '/' . $fileName);
             return removeMultiple('<script type="text/javascript" src="' . $temp . '"></script>') . PHP_EOL;
         }
     }
 }
开发者ID:shlappdev,项目名称:shl-framework,代码行数:19,代码来源:Html.php


示例17: __construct

 /**
  * コンストラクタ
  *
  * @return	void
  * @access	private
  */
 function __construct($id = false, $table = null, $ds = null)
 {
     if ($this->useDbConfig && ($this->name || !empty($id['name']))) {
         // DBの設定がない場合、存在しないURLをリクエストすると、エラーが繰り返されてしまい
         // Cakeの正常なエラーページが表示されないので、設定がある場合のみ親のコンストラクタを呼び出す。
         $cm =& ConnectionManager::getInstance();
         if (isset($cm->config->baser['driver'])) {
             if ($cm->config->baser['driver'] != '') {
                 parent::__construct($id, $table, $ds);
             } elseif ($cm->config->baser['login'] == 'dummy' && $cm->config->baser['password'] == 'dummy' && $cm->config->baser['database'] == 'dummy' && Configure::read('Baser.urlParam') == '') {
                 // データベース設定がインストール段階の状態でトップページへのアクセスの場合、
                 // 初期化ページにリダイレクトする
                 App::import('Controller', 'App');
                 $AppController = new AppController();
                 session_start();
                 $_SESSION['Message']['flash'] = array('message' => 'インストールに失敗している可能性があります。<br />インストールを最初からやり直すにはbaserCMSを初期化してください。', 'layout' => 'default');
                 $AppController->redirect(baseUrl() . 'installations/reset');
             }
         }
     }
 }
开发者ID:nojimage,项目名称:basercms,代码行数:27,代码来源:baser_app_model.php


示例18: redirect

function redirect($path = '/', $lvl = 2, $header = 301)
{
    switch ($header) {
        case 301:
            $header = 'HTTP/1.1 301 Moved Permanently';
            break;
        case 403:
            $header = 'HTTP/1.1 403 Forbidden';
            break;
    }
    $url = $path;
    if (is_array($path)) {
        $dir = each($path);
        $url = BASE_PATH . '/' . $dir['key'] . '/' . $dir['value'];
    }
    if ($lvl >= 2) {
        $url = baseUrl($url, $lvl);
    }
    header($header);
    header("Location: {$url}");
    exit;
}
开发者ID:parsinegar2015,项目名称:parsinegar,代码行数:22,代码来源:bootstrap.php


示例19: use

 public function use(...$scripts)
 {
     $str = '';
     $eol = EOL;
     $args = $this->_parameters($scripts, 'scripts');
     $lastParam = $args->lastParam;
     $arguments = $args->arguments;
     $links = $args->cdnLinks;
     foreach ($arguments as $script) {
         if (is_array($script)) {
             $script = '';
         }
         $scriptFile = SCRIPTS_DIR . suffix($script, ".js");
         if (!is_file($scriptFile)) {
             $scriptFile = EXTERNAL_SCRIPTS_DIR . suffix($script, ".js");
         }
         if (!in_array("script_" . $script, Properties::$isImport)) {
             if (is_file($scriptFile)) {
                 $str .= '<script type="text/javascript" src="' . baseUrl($scriptFile) . '"></script>' . $eol;
             } elseif (isUrl($script) && extension($script) === 'js') {
                 $str .= '<script type="text/javascript" src="' . $script . '"></script>' . $eol;
             } elseif (isset($links[strtolower($script)])) {
                 $str .= '<script type="text/javascript" src="' . $links[strtolower($script)] . '"></script>' . $eol;
             }
             Properties::$isImport[] = "script_" . $script;
         }
     }
     if (!empty($str)) {
         if ($lastParam === true) {
             return $str;
         } else {
             echo $str;
         }
     } else {
         return false;
     }
 }
开发者ID:znframework,项目名称:znframework,代码行数:37,代码来源:Script.php


示例20: use

 public function use(...$styles)
 {
     $str = '';
     $eol = EOL;
     $args = $this->_parameters($styles, 'styles');
     $lastParam = $args->lastParam;
     $arguments = $args->arguments;
     $links = $args->cdnLinks;
     foreach ($arguments as $style) {
         if (is_array($style)) {
             $style = '';
         }
         $styleFile = STYLES_DIR . suffix($style, ".css");
         if (!is_file($styleFile)) {
             $styleFile = EXTERNAL_STYLES_DIR . suffix($style, ".css");
         }
         if (!in_array("style_" . $style, Properties::$isImport)) {
             if (is_file($styleFile)) {
                 $str .= '<link href="' . baseUrl($styleFile) . '" rel="stylesheet" type="text/css" />' . $eol;
             } elseif (isUrl($style) && extension($style) === 'css') {
                 $str .= '<link href="' . $style . '" rel="stylesheet" type="text/css" />' . $eol;
             } elseif (isset($links[strtolower($style)])) {
                 $str .= '<link href="' . $links[strtolower($style)] . '" rel="stylesheet" type="text/css" />' . $eol;
             }
             Properties::$isImport[] = "style_" . $style;
         }
     }
     if (!empty($str)) {
         if ($lastParam === true) {
             return $str;
         } else {
             echo $str;
         }
     } else {
         return false;
     }
 }
开发者ID:znframework,项目名称:znframework,代码行数:37,代码来源:Style.php



注:本文中的baseUrl函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP base_URL函数代码示例发布时间:2022-05-24
下一篇:
PHP basePath函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap