本文整理匯總了PHP中StringUtils::arrayToString方法的典型用法代碼示例。如果您正苦於以下問題:PHP StringUtils::arrayToString方法的具體用法?PHP StringUtils::arrayToString怎麽用?PHP StringUtils::arrayToString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類StringUtils
的用法示例。
在下文中一共展示了StringUtils::arrayToString方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testArrayToStringEndSeparator
/**
* @covers StringUtils::arrayToString
*/
public function testArrayToStringEndSeparator()
{
$data = array("Benjamin", "Sidiki", "Leyla", 23, 24, "Malek");
$actual = \StringUtils::arrayToString($data, ':', true);
$excepted = "Benjamin:Sidiki:Leyla:23:24:Malek:";
$this->assertEquals($excepted, $actual);
}
示例2: __toString
public function __toString()
{
$html = "<div class='crumbs'>";
$cumbsTxt = StringUtils::arrayToString($this->items, " → ");
$html .= $cumbsTxt;
$html .= "</div>";
return $html;
}
示例3: setOnClick
private function setOnClick()
{
// Avoid setting the 'onclick' attribute if it's not needed
if (!$this->onclickNeeded) {
return;
}
$params = array($this->href);
if ($this->target) {
$params[] = $this->target;
}
// Surround params with single quotes
$params = array_map(function ($str) {
return "'" . $str . "'";
}, $params);
$paramListString = implode(', ', $params);
$jsFunctionName = $this->submit ? 'button_submit' : 'button_click';
$onclick = "{$jsFunctionName}({$paramListString}); return false";
$this->onclick[] = $onclick;
$onclickStr = StringUtils::arrayToString($this->onclick, "; ", true);
parent::set("onclick", $onclickStr);
}
示例4: getOnUnloadValue
public function getOnUnloadValue()
{
$text = StringUtils::arrayToString($this->onunload, ";", true);
return $text;
}