本文整理匯總了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);
}