個人用ツール

「ver4/関数リファレンス/url」の版間の差分

提供: baserCMS公式ガイド

移動: 案内, 検索
行21: 行21:
 
: - 初期値 : true
 
: - 初期値 : true
  
## 戻り値
 
なし
 
  
 
## 用例
 
## 用例
 
### 基本
 
### 基本
 
baserCMSの設置フォルダからのURLを出力する。<br>
 
baserCMSの設置フォルダからのURLを出力する。<br>
例)localhost/service/の場合
+
例)localhost/about/の場合
 
####コード
 
####コード
 
<syntaxhighlight lang="php">
 
<syntaxhighlight lang="php">
行35: 行33:
 
####出力
 
####出力
 
<syntaxhighlight lang="html5">
 
<syntaxhighlight lang="html5">
/service/
+
/about
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
 
### 応用
 
### 応用
 +
/about/を指定、http://から始まるURLで出力し、セッションIDを付加しない。
 
####コード
 
####コード
 
<syntaxhighlight lang="php">
 
<syntaxhighlight lang="php">
 
+
<?php $this->BcBaser->url('/about',true,false); ?>
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
####出力
 
####出力
 
<syntaxhighlight lang="html5">
 
<syntaxhighlight lang="html5">
 
+
http://localhost/about
 
</syntaxhighlight>
 
</syntaxhighlight>
  
## 注
 
 
## 変更履歴
 
 
## ソースファイル
 
 
## 関連資料
 
  
 
##類似の関数
 
##類似の関数
行61: 行55:
 
- [getSiteUrl](/ver4/関数リファレンス/getSiteUrl) - WEBサイトURLを取得する
 
- [getSiteUrl](/ver4/関数リファレンス/getSiteUrl) - WEBサイトURLを取得する
 
- [siteUrl](/ver4/関数リファレンス/siteUrl) - WEBサイトURLを出力する
 
- [siteUrl](/ver4/関数リファレンス/siteUrl) - WEBサイトURLを出力する
 
[[Category:関数リファレンス]]
 

2019年1月18日 (金) 00:10時点における版

説明

baserCMSの設置フォルダを考慮したURLを出力する。

使い方

<?php $this->BcBaser->url( [$url] , [$full] , [$sessionId] ); ?>

パラメータ

(mixed) $url
baserCMS設置フォルダからの絶対URL、もしくは配列形式のURL情報
省略した場合には、PC用のトップページのURLを出力する
- 初期値 : null
(bool) $full
httpから始まるURLを取得するかどうか
- 初期値 : false
(bool) $sessionId
セションIDを付加するかどうか
- 初期値 : true

用例

基本

baserCMSの設置フォルダからのURLを出力する。
例)localhost/about/の場合

コード

<?php $this->BcBaser->url(); ?>

出力

/about

応用

/about/を指定、http://から始まるURLで出力し、セッションIDを付加しない。

コード

<?php $this->BcBaser->url('/about',true,false); ?>

出力

http://localhost/about

類似の関数

  • getUrl - baserCMSの設置フォルダを考慮したURLを取得する
  • getUri - httpから始まるURLを取得する
  • getSiteUrl - WEBサイトURLを取得する
  • siteUrl - WEBサイトURLを出力する