Sitemap::__construct
空のサイトマップを作成します
説明
public Sitemap::__construct( [ string $baseUrl = '' ] )
$baseUrlは、パスの前に付けるルートURLです。''なら現在のリクエストのURL(FEGG_CURRENT_URL:スキーム、ホスト、ベースパス)を使います。
引数
| 名前 | データ型 | デフォルト | 備考 |
|---|---|---|---|
| $baseUrl | string | '' | サイトのルートURL(ベースパスを含む)。''なら現在のリクエストのURL |
例
Controller
use Fegg\Tool\Sitemap;
$sitemap = new Sitemap(); // URLs of the current host
$sitemap = new Sitemap('https://www.example.com'); // always the production host
リクエストの外でサイトマップを書き出すとき(ファイルとして保存するコマンドなど)は、ルートURLを渡してください。