本文整理汇总了PHP中baseUrl函数的典型用法代码示例。如果您正苦于以下问题:PHP baseUrl函数的具体用法?PHP baseUrl怎么用?PHP baseUrl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了baseUrl函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: url
/**
* @param $path
* @return string
*/
function url($path)
{
if (substr($path, 0, 1) === '/') {
$path = substr($path, 1);
}
return baseUrl() . $path;
}
示例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));
}
示例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));
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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;
});
}
示例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;
}
}
示例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('&', '&', $view->output);
$view->output = str_replace('<', '<', $view->output);
$view->output = str_replace('>', '>', $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);
}
}