本文整理匯總了PHP中URLSegmentFilter::default_allow_multibyte方法的典型用法代碼示例。如果您正苦於以下問題:PHP URLSegmentFilter::default_allow_multibyte方法的具體用法?PHP URLSegmentFilter::default_allow_multibyte怎麽用?PHP URLSegmentFilter::default_allow_multibyte使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類URLSegmentFilter
的用法示例。
在下文中一共展示了URLSegmentFilter::default_allow_multibyte方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testRaw2URL
/**
* @todo test toASCII()
*/
public function testRaw2URL()
{
$orig = URLSegmentFilter::$default_allow_multibyte;
URLSegmentFilter::$default_allow_multibyte = false;
$this->assertEquals('foo', Convert::raw2url('foo'));
$this->assertEquals('foo-and-bar', Convert::raw2url('foo & bar'));
$this->assertEquals('foo-and-bar', Convert::raw2url('foo & bar!'));
$this->assertEquals('foos-bar-2', Convert::raw2url('foo\'s [bar] (2)'));
URLSegmentFilter::$default_allow_multibyte = $orig;
}
示例2: testURLSegmentMultiByte
public function testURLSegmentMultiByte()
{
$origAllow = URLSegmentFilter::$default_allow_multibyte;
URLSegmentFilter::$default_allow_multibyte = true;
$sitetree = new SiteTree();
$sitetree->write();
$sitetree->URLSegment = 'brötchen';
$sitetree->write();
$sitetree = DataObject::get_by_id('SiteTree', $sitetree->ID, false);
$this->assertEquals($sitetree->URLSegment, rawurlencode('brötchen'));
$sitetree->publish('Stage', 'Live');
$sitetree = DataObject::get_by_id('SiteTree', $sitetree->ID, false);
$this->assertEquals($sitetree->URLSegment, rawurlencode('brötchen'));
$sitetreeLive = Versioned::get_one_by_stage('SiteTree', 'Live', '"SiteTree"."ID" = ' . $sitetree->ID, false);
$this->assertEquals($sitetreeLive->URLSegment, rawurlencode('brötchen'));
URLSegmentFilter::$default_allow_multibyte = $origAllow;
}