本文整理汇总了PHP中CopixUrl::extractParams方法的典型用法代码示例。如果您正苦于以下问题:PHP CopixUrl::extractParams方法的具体用法?PHP CopixUrl::extractParams怎么用?PHP CopixUrl::extractParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CopixUrl
的用法示例。
在下文中一共展示了CopixUrl::extractParams方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testParams
public function testParams()
{
$pUrl = 'test.php';
$pUrlParam = 'test.php?param=value';
$pUrlParams = 'test.php?param1=1¶m2=2¶m3=3';
$pUrlParamsXml = 'test.php?param1=1&param2=2&param3=3';
// Test des extrctions de paramètres
$this->assertEquals(CopixUrl::extractParams($pUrl, false), array());
$this->assertEquals(CopixUrl::extractParams($pUrlParam, false), array('param' => 'value'));
$this->assertEquals(CopixUrl::extractParams($pUrlParam, true), array('param' => 'value'));
$this->assertEquals(CopixUrl::extractParams($pUrlParams, false), array('param1' => 1, 'param2' => 2, 'param3' => 3));
$this->assertEquals(CopixUrl::extractParams($pUrlParamsXml, true), array('param1' => 1, 'param2' => 2, 'param3' => 3));
// Test des suppressions de paramètres
$this->assertEquals(CopixUrl::removeParams($pUrl, array('param1')), $pUrl);
$this->assertEquals(CopixUrl::removeParams($pUrlParam, array('param')), $pUrl);
$this->assertEquals(CopixUrl::removeParams($pUrlParams, array('param1')), 'test.php?param2=2¶m3=3');
$this->assertEquals(CopixUrl::removeParams($pUrlParams, array('param2')), 'test.php?param1=1¶m3=3');
$this->assertEquals(CopixUrl::removeParams($pUrlParams, array('param3')), 'test.php?param1=1¶m2=2');
$this->assertEquals(CopixUrl::removeParams($pUrlParamsXml, array('param1'), true), 'test.php?param2=2&param3=3');
$this->assertEquals(CopixUrl::removeParams($pUrlParamsXml, array('param2'), true), 'test.php?param1=1&param3=3');
$this->assertEquals(CopixUrl::removeParams($pUrlParamsXml, array('param3'), true), 'test.php?param1=1&param2=2');
// Test des ajout de paramètres
$this->assertEquals(CopixUrl::appendToUrl($pUrl), $pUrl);
$this->assertEquals(CopixUrl::appendToUrl($pUrl, array('param' => 'value')), $pUrlParam);
$this->assertEquals(CopixUrl::appendToUrl($pUrl, array('param1' => '1', 'param2' => '2', 'param3' => '3')), $pUrlParams);
$this->assertEquals(CopixUrl::appendToUrl($pUrl, array('param1' => '1', 'param2' => '2', 'param3' => '3'), true), $pUrlParamsXml);
}