当前位置: 首页>>代码示例>>PHP>>正文


PHP jUrl::parse方法代码示例

本文整理汇总了PHP中jUrl::parse方法的典型用法代码示例。如果您正苦于以下问题:PHP jUrl::parse方法的具体用法?PHP jUrl::parse怎么用?PHP jUrl::parse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jUrl的用法示例。


在下文中一共展示了jUrl::parse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testBasicSignificantEngine

 function testBasicSignificantEngine()
 {
     global $gJConfig, $gJCoord;
     $gJCoord->request->urlScriptPath = '/';
     $gJCoord->request->params = array();
     //$gJCoord->request->type=;
     $gJConfig->urlengine = array('engine' => 'basic_significant', 'enableParser' => true, 'multiview' => false, 'basePath' => '/', 'defaultEntrypoint' => 'index', 'entrypointExtension' => '.php', 'notfoundAct' => 'jelix~notfound', 'significantFile' => 'urls.xml');
     jUrl::getEngine(true);
     // on recharge le nouveau moteur d'url
     $resultList = array();
     $resultList[] = array('module' => 'jelix_tests', 'action' => 'urlsig:url1', 'mois' => '10', 'annee' => '2005', 'id' => '35');
     $resultList[] = array('module' => 'jelix_tests', 'action' => 'urlsig:url2', 'mois' => '05', 'annee' => '2004');
     $resultList[] = array('module' => 'jelix_tests', 'action' => 'urlsig:url3', 'rubrique' => 'actualite', 'id_art' => '65', 'article' => 'c\'est la fete au village');
     $resultList[] = array('module' => 'jelix_tests', 'action' => 'urlsig:url4', 'first' => 'premier', 'second' => 'deuxieme');
     $resultList[] = array();
     $resultList[] = array('module' => 'news', 'action' => 'main:bar', 'aaa' => 'bbb');
     $resultList[] = array('module' => 'jelix_tests', 'action' => 'urlsig:url5', 'foo' => 'oof', 'bar' => 'rab');
     $resultList[] = array('module' => 'jelix_tests', 'action' => 'urlsig:url8', 'rubrique' => 'vetements', 'id_article' => '98');
     $resultList[] = array('module' => 'jelix_tests', 'action' => 'default:index', 'rubrique' => 'vetements', 'id_article' => '98');
     $resultList[] = array('module' => 'jelix_tests', 'action' => 'urlsig:index', 'rubrique' => 'vetements', 'id_article' => '98');
     $resultList[] = array('rubrique' => 'vetements', 'id_article' => '98');
     $resultList[] = array('module' => 'jelix_tests', 'action' => 'actu:foo', 'aaa' => 'bbb');
     $resultList[] = array('module' => 'jelix_tests', 'action' => 'actu:bar', 'aaa' => 'bbb');
     $resultList[] = array('module' => 'jelix_tests', 'action' => 'urlsig:bar', 'aaa' => 'bbb');
     $request = array(array("index.php", "/jelix_tests/urlsig/url1", array('mois' => '10', 'annee' => '2005', 'id' => '35')), array("testnews.php", "/jelix_tests/urlsig/url2", array('mois' => '05', 'annee' => '2004')), array("testnews.php", "/jelix_tests/urlsig/url3", array('rubrique' => 'actualite', 'id_art' => '65', 'article' => 'c\'est la fete au village')), array("foo/bar.php", "/jelix_tests/urlsig/url4", array('first' => 'premier', 'second' => 'deuxieme')), array("xmlrpc.php", "", array()), array("news.php", "/news/main/bar", array('aaa' => 'bbb')), array("index.php", "/jelix_tests/urlsig/url5", array('foo' => 'oof', 'bar' => 'rab')), array("index.php", "/jelix_tests/urlsig/url8", array('rubrique' => 'vetements', 'id_article' => '98')), array("index.php", "/jelix_tests/", array('rubrique' => 'vetements', 'id_article' => '98')), array("index.php", "/jelix_tests/urlsig/", array('rubrique' => 'vetements', 'id_article' => '98')), array("index.php", "", array('rubrique' => 'vetements', 'id_article' => '98')), array("actu.php", "/jelix_tests/actu/foo", array('aaa' => 'bbb')), array("actu.php", "/jelix_tests/actu/bar", array('aaa' => 'bbb')), array("actu.php", "/jelix_tests/urlsig/bar", array('aaa' => 'bbb')));
     //$this->sendMessage("significant, multiview = false");
     foreach ($request as $k => $urldata) {
         $url = jUrl::parse($urldata[0], $urldata[1], $urldata[2]);
         $p = $url->params;
         ksort($p);
         ksort($resultList[$k]);
         $this->assertTrue($p == $resultList[$k], 'created:' . var_export($p, true) . ' expected:' . var_export($resultList[$k], true));
     }
     $gJConfig->urlengine['multiview'] = true;
     $request = array(array("index", "/jelix_tests/urlsig/url1", array('mois' => '10', 'annee' => '2005', 'id' => '35')), array("testnews", "/jelix_tests/urlsig/url2", array('mois' => '05', 'annee' => '2004')), array("testnews", "/jelix_tests/urlsig/url3", array('rubrique' => 'actualite', 'id_art' => '65', 'article' => 'c\'est la fete au village')), array("foo/bar", "/jelix_tests/urlsig/url4", array('first' => 'premier', 'second' => 'deuxieme')), array("xmlrpc", "", array()), array("news", "/news/main/bar", array('aaa' => 'bbb')), array("index", "/jelix_tests/urlsig/url5", array('foo' => 'oof', 'bar' => 'rab')), array("index", "/jelix_tests/urlsig/url8", array('rubrique' => 'vetements', 'id_article' => '98')), array("index", "/jelix_tests/", array('rubrique' => 'vetements', 'id_article' => '98')), array("index", "/jelix_tests/urlsig/", array('rubrique' => 'vetements', 'id_article' => '98')), array("index", "", array('rubrique' => 'vetements', 'id_article' => '98')), array("actu.php", "/jelix_tests/actu/foo", array('aaa' => 'bbb')), array("actu.php", "/jelix_tests/actu/bar", array('aaa' => 'bbb')), array("actu.php", "/jelix_tests/urlsig/bar", array('aaa' => 'bbb')));
     foreach ($request as $k => $urldata) {
         $url = jUrl::parse($urldata[0], $urldata[1], $urldata[2]);
         $p = $url->params;
         ksort($p);
         ksort($resultList[$k]);
         $this->assertTrue($p == $resultList[$k], 'created:' . var_export($p, true) . ' expected:' . var_export($resultList[$k], true));
     }
 }
开发者ID:hadrienl,项目名称:jelix,代码行数:43,代码来源:core.urls_parsing.html_cli.php


注:本文中的jUrl::parse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。