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


PHP Web::slug方法代码示例

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


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

示例1: web

    function web()
    {
        $this->set('title', 'Web Tools');
        $this->expect(is_null($this->get('ERROR')), 'No errors expected at this point', 'ERROR variable is set: ' . $this->get('ERROR.text'));
        $this->expect(extension_loaded('sockets'), 'Sockets extension available', 'Sockets extension is not active - unable to continue');
        if (extension_loaded('sockets')) {
            $text = 'Ñõw is the tîme~for all good mên. to cóme! to the aid 0f-thëir_côuntry';
            $this->expect(Web::slug($text) == 'now-is-the-time-for-all-good-men-to-come-to-the-aid-0f-their_country', 'Framework generates correct URL-friendly version of string', 'Incorrect URL-friendly string conversion: ' . Web::slug($text));
            $this->set('QUIET', TRUE);
            $text = Web::http('GET http://' . $_SERVER['HTTP_HOST'] . '/minified/reset.css');
            $this->expect($text == 'html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline;}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block;}body{line-height:1;}ol,ul{list-style:none;}blockquote,q{quotes:none;}blockquote:before,blockquote:after,q:before,q:after{content:\'\';content:none;}table{border-collapse:collapse;border-spacing:0;}', 'CSS minified ' . round(100 * (filesize('gui/reset.css') - strlen($text)) / filesize('gui/reset.css'), 1) . '%: ' . strlen($text) . ' bytes; ' . 'original size: ' . filesize('gui/reset.css') . ' bytes', 'CSS minification issue: ' . var_export($text, true));
            $this->set('QUIET', FALSE);
            $this->set('QUIET', TRUE);
            $text = Web::http('GET http://' . $_SERVER['HTTP_HOST'] . '/minified/simple.css');
            $this->expect($text == 'div *{text-align:center;}#content{border:1px #000 solid;text-shadow:#ccc -1px -1px 0px;}', 'CSS minified properly - necessary (and IE-problematic) spaces preserved', 'CSS minified incorrectly: ' . var_export($text, true));
            $this->set('QUIET', FALSE);
            $this->set('QUIET', TRUE);
            $text = Web::http('GET http://' . $_SERVER['HTTP_HOST'] . '/minified/cookie.js');
            $this->expect($text == 'function getCookie(c_name){if(document.cookie.length>0){c_start=document.cookie.indexOf(c_name+"=");if(c_start!=-1){c_start=c_start+c_name.length+1;c_end=document.cookie.indexOf(";",c_start);if(c_end==-1)c_end=document.cookie.length
return unescape(document.cookie.substring(c_start,c_end));}}return""}function setCookie(c_name,value,expiredays){var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays);document.cookie=c_name+"="+escape(value)+((expiredays==null)?"":"; expires="+exdate.toUTCString());}function checkCookie(){username=getCookie(\'username\');if(username!=null&&username!=""){alert(\'Welcome again \'+username+\'!\');}else{username=prompt(\'Please enter your name:\',"");if(username!=null&&username!=""){setCookie(\'username\',username,365);}}}', 'Javascript minified ' . round(100 * (filesize('gui/cookie.js') - strlen($text)) / filesize('gui/cookie.js'), 1) . '%: ' . strlen($text) . ' bytes; ' . 'original size: ' . filesize('gui/cookie.js') . ' bytes', 'Javascript minification issue: ' . var_export($text, true));
            $this->set('QUIET', FALSE);
            echo $this->render('basic/results.htm');
        }
    }
开发者ID:nian2go,项目名称:fatfree,代码行数:24,代码来源:main.php

示例2: clean

 public function clean($string)
 {
     return "%" . Web::slug(str_replace('\'', '', str_replace(' ', '-', $string))) . "%";
 }
开发者ID:huckfinnaafb,项目名称:leviatha,代码行数:4,代码来源:SearchModel.php


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