本文整理汇总了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;
}