- 1. 概要
- 2. 使ってみる
1. 概要
インストールについて、納得できたので、使ってみます。
2. 使ってみる
参考サイトに習って、下記のソースを書きました。
<?php
require 'パス/.composer/vendor/autoload.php';
use GuzzleHttp\Psr7\Uri;
$relative = '../sample.html';
$baseurl = 'http://sample.com/path/to/index.html';
$base = new Uri($baseurl);
$absolute = (string) Uri::resolve($base, $relative);
print($baseurl."\n");
print($relative."\n");
print($absolute."\n");
これを実行すると
http://sample.com/path/to/index.html
../sample.html
http://sample.com/path/sample.html
となりまして。
やっと、思い通りになったのであります。
|