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


PHP str::urlify方法代码示例

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


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

示例1: fetch

 static function fetch($file)
 {
     if (!file_exists($file)) {
         return array();
     }
     $content = f::read($file);
     $content = str_replace("", '', $content);
     $sections = preg_split('![\\r\\n]+[-]{4,}!i', $content);
     $data = array();
     foreach ($sections as $s) {
         $parts = explode(':', $s);
         if (count($parts) == 1 && count($sections) == 1) {
             return $content;
         }
         $key = str::urlify($parts[0]);
         if (empty($key)) {
             continue;
         }
         $value = trim(implode(':', array_slice($parts, 1)));
         $data[$key] = $value;
     }
     return $data;
 }
开发者ID:narrenfrei,项目名称:kirbycms,代码行数:23,代码来源:variables.php

示例2: safe_name

 /**
  * Sanitize a filename to strip unwanted special characters
  * 
  * @param  string $string The file name
  * @return string
  */
 static function safe_name($string)
 {
     return str::urlify($string);
 }
开发者ID:sdvig,项目名称:kirbycms,代码行数:10,代码来源:kirby.php

示例3: write

 static function write($file, $values)
 {
     if (file_exists($file) && !is_writable($file)) {
         return array('status' => 'error', 'msg' => l::get('writer.errors.permissions'));
     }
     $break = false;
     $result = "";
     $keys = array();
     foreach ($values as $k => $v) {
         $k = str::urlify($k);
         $k = str::ucfirst(str_replace('-', '_', $k));
         if (in_array($k, $keys) || empty($k)) {
             continue;
         }
         $keys[] = $k;
         $result .= $break . $k . ': ' . trim($v);
         $break = "\n\n----\n\n";
     }
     @chmod(basename($file), 0666);
     $write = f::write($file, $result);
     if (!$write || !file_exists($file)) {
         return array('status' => 'error', 'msg' => l::get('writer.errors.write'));
     }
     return array('status' => 'success', 'msg' => l::get('writer.success'));
 }
开发者ID:nilshendriks,项目名称:kirbycms-panel,代码行数:25,代码来源:data.php

示例4: elseif

</h1>
                <nav>
<?php 
$company = $page->company();
if ($company == 'Isle of Wight') {
    ?>
                    <a rel="up" href="/regions/england/isle-of-wight">Isle of Wight</a>
<?php 
} elseif ($company == 'London') {
    ?>
                    <a rel="up" href="/regions/england/london">London</a>
<?php 
} else {
    ?>
                    <a rel="up" href="/companies/<?php 
    echo preg_replace('/-railway$/', '', str::urlify($page->company()));
    ?>
"><?php 
    echo smartypants($page->company());
    ?>
</a>
<?php 
}
?>
                </nav>
            </header>

<?php 
if ($page->text != "") {
    ?>
            <div class="e-content prose">
开发者ID:ajmalafif,项目名称:bradshawsguide,代码行数:31,代码来源:route.php


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