JBZoo\Utils\Str::slug PHP 메소드

slug() 공개 정적인 메소드

Converts any accent characters to their equivalent normal characters
public static slug ( string $text = '', boolean $isCache = false ) : string
$text string
$isCache boolean
리턴 string
    public static function slug($text = '', $isCache = false)
    {
        static $cache = array();
        if (!$isCache) {
            return Slug::filter($text);
        } elseif (!array_key_exists($text, $cache)) {
            // Not Arr::key() for performance
            $cache[$text] = Slug::filter($text);
        }
        return $cache[$text];
    }

Usage Example

예제 #1
0
파일: Checkbox.php 프로젝트: JBZoo/Html
 /**
  * Reload default template.
  *
  * @param string $name
  * @param string $value
  * @param string $id
  * @param string $text
  * @param array $attrs
  * @return string
  */
 protected function _elementTpl($name, $value = '', $id = '', $text = '', array $attrs = array())
 {
     $alias = Str::slug($value, true);
     $inpClass = 'jb-val-' . $alias;
     $input = $this->input($name, $value, $id, $inpClass, $attrs);
     $text = '<span class="label-title">' . $text . '</span>';
     $html = $this->label($id, $alias, $input . $text);
     return '<div class="jb-input jb-checkbox">' . $html . '</div>';
 }
All Usage Examples Of JBZoo\Utils\Str::slug