PHP中一個文檔中沒有的特色[轉(zhuǎn)自奧索]
Jun 21, 2016 am 09:12 AMPHP中的面向?qū)ο蠊δ苤С?C++ 式的 :: 運算符號?。?!
//孤狼:這個::在PEAR中可是頻頻出現(xiàn),第一次見的時候搞的我莫名其妙 :)
這個特色文檔沒有任何說明,但是卻有著很好的使用價值。
舉一個簡單的例子:
比如你以前有很多收集的函數(shù)庫,你想轉(zhuǎn)向 OOP 方式編程,但是還不能做到完全的封裝。 這個特色提供你一個OOP風(fēng)格的實現(xiàn)。
你定義一個 Util 類:
class Util {
//將所有的函數(shù)剪輯到這里
//這個類可以沒有任何成員函數(shù)
}
然后在你原先使用函數(shù)的地方,比如 someFunction(), 修改成:
Util::someFunction(). 這對你需要封裝,但是不需要任何成員函數(shù)非常有用。

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

???? ???? ??? ???? ???(Class): ??? ??? ???? ?? ??? ???? ???? ? ?????. ???? ?? ??? ???? ??? ???? ?????. ??? ???? ???????. ???: ???? ??? ?????. ??? ?? ??? __init__(): ????? ???? ?????? ? ???? ???? init()?? ?? ???(?? ???)? ????. ???? ??: ??? ???? ??? ??? ?????. ??? ??? ???? ???? ???. ?????: ???? ?? ??? ???? ????? ????. ??: ?, ?? ???(derivedclass)? ?? ???(baseclass)? ?????.

???? ???? ???? ? ???? ??????. ??? ?? ??? ???? ??? ??? ?????. ??: ? ??? ?? ?? ?? ?? ???? ?????. [class Dog()]? ?? ?? ??.

jQuery? ? ??? ?? ???? ??? JavaScript ??????, ??? ??, DOM ?? ??, ? ????? ????? ??? ?? ??? ??????. jQuery? ??? ? ??? ??? ??? ??? ?? ??? ?? ?????. ? ????? ? ?? ???? ??? ???? ?? ??? ?????. 1. RemoveClass() ? addClass() ??? ?? jQuery? ??? ?? RemoveClass() ???? ?????.

Vue ??: v-bind? ???? ???? ???? ???? ???? ? ????. ??? ?????? Vue ????? ???? ???? ???? ????? ?? v-bind ???? ???? ??? ???, ???? ???? ????? ?? v-bind? ???? ???? ??? ?? ??? ??? ?? ????. ?? ???? ? ??? ??? ???? ?? ??? ????????. ?? v-bind ???? ??? ???. v-bind? V? ????? ? ?????.
!['[Vue ??]: v-bind:class/ :class' ?? ?? ??](https://img.php.cn/upload/article/000/465/014/169300902772563.jpg?x-oss-process=image/resize,m_fill,h_207,w_330)
"[Vuewarn]:v-bind:class/:class" ??? ???? ?? Vue? ???? ?? ???? ?? ???? ?? ? ??? "[Vuewarn]:v-bind:class???. " /:???" ??. ? ?? ???? ????? v-bind:class ?? :class ??? ??? ? ?????. ?? Vue? ??? ??? ??? ?? ???? ?? ??? ? ??? ?????. ???? ??

PHP ??? ??? ? ???? ???? ?? ?? ???? ?????. ???? ???? ?? ??? ???? ?? ??? ????? ??? ? ????, ?? ??, ?? ???? ?? ?? ? ????. ? ????? PHPClass? ???? ??? ???? ???? ?? ??? ???? ??? ?? ????? ???? ???? ??? ????? ??? ? ? ??? ? ??? ????. 1. ??? ?? ? ?? PHP??? ??? ???? ???? ???? ???? ???? ??? ???? ??? ? ????.

jquery? ??? ???? ??? ???? ??: 1. "hasClass('classname')" ???? ?? ??? ?? ???? ??? ?????. 2. "is('.classname)? ?? ??? ?? ???? ??? ?????. ')" ??.

?? ?? ??????? ?????? ?? ?? ?????(OOP)? ?? ???? ???? ????? ??? ???? ??? ???? ???? ????? ???????. ???? ??? ??? ??? ????, ??? ???? ????????. OOP? ?? ? ??? ??? ? ?? ???? ?? ???? ???? ? ??? ????. OOP? ?? ?? OOP? ?? ???? ???, ??, ?? ? ???? ?????. ???? ??? ??? ??? ???? ??? ??????. ??? ???? ?????? ???? ?? ??? ??? ????. ??? ???? ??? ? ?? ??? ?????. ???? ??? ???? ?? ??? ? ?? ??? ?????. OOP? ?? OOP? ?? ??? ??? ????. ????: OOP? ??? ? ?? ?? ? ????.
