php manual(8)
时间:2007-07-19 来源:skilldream
1.2 AJAX
Cake Ajax helper实现了更加popular的Prototype和script.aculo.us库赖提供Ajax操作和客户端效果。如果想使用这些helper,你必须有从
http://script.aculo.us
下载一份JavaScript libraries到/app/webroot/js目录下
这个helper里面的削夺方法多扩展了特殊的$options数组作为参数。这个数组用来确定你的Ajax操作中的各种东西
(liuchen:Ajax暂且略过,以后补充)
1.3 JavaScript
JavaScript helper用来帮助开发者输出标准的tag和数据
●codeBlock($script)
○用来返回$script,变量$script已经包含了标签
●link($url)
○返回包含tag,指向特定$url指定script的脚本
●linkOut($url)
○跟link($url)的作用一样,就是参数$url不在本地
●escapeScript($script)
○Escapes carriage returns and single and double quotes for JavaScript code segments.
●event($object, $event, $observer, $useCapture=true)
○使用Prototype库,将一个事件链接到一个元素
●cacheEvents()
○缓存event()创建的JavaScript事件
●writeEvents()
○写cacheEvent()保存的内容
●includeScript($script=””)
○返回含有标签的JavaScript,一般是从Cake的js库中(/app/webroot/js/)
1.4 Number
Number helper包括一些在views中转化数字数据的方法
●precision ($number, $precision=3)
○返回由$precision确定的近似精度的值到$number中
●toReadableSize ($size)
○将bytes为单位的数字转化为用KB、MB、GB、TB等用户比较容易明白的数字
●toPercentage ($number, $precision=2)
○转化为百分数
1.5 Text
The Text Helper提供了一些方法,开发者可以使用这些方法来更好的将text输出到浏览器
●highlight ($text, $phrase, $highlighter= '\1')
○将$text中所有$phrase都放在一个标签里,返回$text
●stripLinks ($text)
○将所有的链接标签都删除后返回
●autoLinkUrls ($text, $htmlOptions=array())
○将所有的URL自动添加标签
●autoLinkEmails ($text, $htmlOptions=array())
○将所有的email地址自动添加标签
●autoLink ($text, $htmlOptions=array())
○将所有的URL和email地址都自动添加标签
●truncate ($text, $length, $ending='...')
○Returns the first $length number of characters of $text followed by $ending ('...' by default).(不明白)
●trim ()
○Alias for truncate().
●excerpt ($text, $phrase, $radius=100, $ending="...")
○Extracts an excerpt from the $text, grabbing the $phrase with a number of characters on each side determined by $radius.
●flay($text, $allowHtml=false)
○Text-to-html parser, similar to Textile or RedCloth, only with a little different syntax.
1.6 Time
Time Helper提供了一些方法,卡发者可以使用这些方法将时间方便的显示到浏览器上。时间可以提供的形式包括PHP的datatime字符串或者是Unix的时间戳
●fromString ($date_string)
○根据输入的两种类型的时间返回Unix时间戳
●nice ($date_string=null, $return=false)
○返回一个良好格式的时间字符串。比如Mon, Jan 1st 2005, 12:00
●niceShort ($date_string=null, $return=false)
○跟nice类似,就是返回昨天和今天的时候,返回Yesterday, 12:00和Today, 12:00
●isToday ($date_string)
○返回给定的时间是否是今天
●daysAsSql ($begin, $end, $field_name, $return=false)
○根据前后两个时间,返回一条sql查询语句,查找两个时间段内的记录
●dayAsSql ($date_string, $field_name, $return=false)
○返回给定时间内的所有记录
●isThisYear ($date_string, $return=false)
○返回是否是今年
●wasYesterday ($date_string, $return=false)
○返回是否是去年
●isTomorrow ($date_string, $return=false)
○返回是否是明天
●toUnix ($date_string, $return=false)
○返回Unix时间戳
●toAtom ($date_string, $return=false)
○Returns a date formatted for Atom RSS feeds.
●toRSS ($date_string, $return=false)
○格式化的RSS时间
●timeAgoInWords ($datetime_string, $return=false)
○Returns either a relative date or a formatted date depending on the difference between the current time and given datetime. $datetime should be in a strtotime-parsable format like MySQL datetime.
●relativeTime ($datetime_string, $return=false)
○Works much like timeAgoInWords(), but includes the ability to create output for timestamps in the future as well (i.e. "Yesterday, 10:33", "Today, 9:42", and also "Tomorrow, 4:34").
●wasWithinLast ($timeInterval, $date_string, $return=false)
○Returns true if specified datetime was within the interval specified, else false. The time interval should be specifed with the number as well as the units: '6 hours', '2 days', etc.
Cake Ajax helper实现了更加popular的Prototype和script.aculo.us库赖提供Ajax操作和客户端效果。如果想使用这些helper,你必须有从
http://script.aculo.us
下载一份JavaScript libraries到/app/webroot/js目录下
这个helper里面的削夺方法多扩展了特殊的$options数组作为参数。这个数组用来确定你的Ajax操作中的各种东西
(liuchen:Ajax暂且略过,以后补充)
1.3 JavaScript
JavaScript helper用来帮助开发者输出标准的tag和数据
●codeBlock($script)
○用来返回$script,变量$script已经包含了标签
●link($url)
○返回包含tag,指向特定$url指定script的脚本
●linkOut($url)
○跟link($url)的作用一样,就是参数$url不在本地
●escapeScript($script)
○Escapes carriage returns and single and double quotes for JavaScript code segments.
●event($object, $event, $observer, $useCapture=true)
○使用Prototype库,将一个事件链接到一个元素
●cacheEvents()
○缓存event()创建的JavaScript事件
●writeEvents()
○写cacheEvent()保存的内容
●includeScript($script=””)
○返回含有标签的JavaScript,一般是从Cake的js库中(/app/webroot/js/)
1.4 Number
Number helper包括一些在views中转化数字数据的方法
●precision ($number, $precision=3)
○返回由$precision确定的近似精度的值到$number中
●toReadableSize ($size)
○将bytes为单位的数字转化为用KB、MB、GB、TB等用户比较容易明白的数字
●toPercentage ($number, $precision=2)
○转化为百分数
1.5 Text
The Text Helper提供了一些方法,开发者可以使用这些方法来更好的将text输出到浏览器
●highlight ($text, $phrase, $highlighter= '\1')
○将$text中所有$phrase都放在一个标签里,返回$text
●stripLinks ($text)
○将所有的链接标签都删除后返回
●autoLinkUrls ($text, $htmlOptions=array())
○将所有的URL自动添加标签
●autoLinkEmails ($text, $htmlOptions=array())
○将所有的email地址自动添加标签
●autoLink ($text, $htmlOptions=array())
○将所有的URL和email地址都自动添加标签
●truncate ($text, $length, $ending='...')
○Returns the first $length number of characters of $text followed by $ending ('...' by default).(不明白)
●trim ()
○Alias for truncate().
●excerpt ($text, $phrase, $radius=100, $ending="...")
○Extracts an excerpt from the $text, grabbing the $phrase with a number of characters on each side determined by $radius.
●flay($text, $allowHtml=false)
○Text-to-html parser, similar to Textile or RedCloth, only with a little different syntax.
1.6 Time
Time Helper提供了一些方法,卡发者可以使用这些方法将时间方便的显示到浏览器上。时间可以提供的形式包括PHP的datatime字符串或者是Unix的时间戳
●fromString ($date_string)
○根据输入的两种类型的时间返回Unix时间戳
●nice ($date_string=null, $return=false)
○返回一个良好格式的时间字符串。比如Mon, Jan 1st 2005, 12:00
●niceShort ($date_string=null, $return=false)
○跟nice类似,就是返回昨天和今天的时候,返回Yesterday, 12:00和Today, 12:00
●isToday ($date_string)
○返回给定的时间是否是今天
●daysAsSql ($begin, $end, $field_name, $return=false)
○根据前后两个时间,返回一条sql查询语句,查找两个时间段内的记录
●dayAsSql ($date_string, $field_name, $return=false)
○返回给定时间内的所有记录
●isThisYear ($date_string, $return=false)
○返回是否是今年
●wasYesterday ($date_string, $return=false)
○返回是否是去年
●isTomorrow ($date_string, $return=false)
○返回是否是明天
●toUnix ($date_string, $return=false)
○返回Unix时间戳
●toAtom ($date_string, $return=false)
○Returns a date formatted for Atom RSS feeds.
●toRSS ($date_string, $return=false)
○格式化的RSS时间
●timeAgoInWords ($datetime_string, $return=false)
○Returns either a relative date or a formatted date depending on the difference between the current time and given datetime. $datetime should be in a strtotime-parsable format like MySQL datetime.
●relativeTime ($datetime_string, $return=false)
○Works much like timeAgoInWords(), but includes the ability to create output for timestamps in the future as well (i.e. "Yesterday, 10:33", "Today, 9:42", and also "Tomorrow, 4:34").
●wasWithinLast ($timeInterval, $date_string, $return=false)
○Returns true if specified datetime was within the interval specified, else false. The time interval should be specifed with the number as well as the units: '6 hours', '2 days', etc.
相关阅读 更多 +
排行榜 更多 +