示例#1
0
 public function testPrependUrl()
 {
     ezcUrlCreator::registerUrl('map', 'http://www.example.com?id=1');
     $expected = 'http://www.example.com/images?id=1';
     $this->assertEquals($expected, ezcUrlCreator::prependUrl('map', 'images'));
 }
示例#2
0
<?php

require_once 'tutorial_autoload.php';
// register an url under the alias 'map'
ezcUrlCreator::registerUrl('map', '/images/geo?xsize=450&ysize=450&zoom=4');
// display the the url prepended to map_norway.gif
var_dump(ezcUrlCreator::prependUrl('map', 'map_norway.gif'));
// display the the url prepended to map_sweden.gif
var_dump(ezcUrlCreator::prependUrl('map', 'map_sweden.gif'));
// display the stored url under the alias 'map'
var_dump(ezcUrlCreator::getUrl('map'));
<?php

require_once 'tutorial_autoload.php';
// register an url under the alias 'map'
ezcUrlCreator::registerUrl('map', '/images/geo/%s?xsize=%d&ysize=%d&zoom=%d');
// display the stored url under the alias 'map' formatted with parameters
var_dump(ezcUrlCreator::getUrl('map', 'map_norway.gif', 450, 450, 4));
// display the stored url under the alias 'map' formatted with other parameters
var_dump(ezcUrlCreator::getUrl('map', 'map_sweden.gif', 450, 450, 4));