使用php轉(zhuǎn)義輸出HTML到JavaScript,轉(zhuǎn)義javascript
Jun 13, 2016 am 09:09 AM使用php轉(zhuǎn)義輸出HTML到JavaScript,轉(zhuǎn)義javascript
最近在做天地圖是GIS集成··要輸出HTML到JavaScript里面··涉及到代碼轉(zhuǎn)義什么的比較麻煩··所以寫個PHP的function
分享一下:
function jsformat($str) { $str = trim($str); $str = str_replace('\\s\\s', '\\s', $str); $str = str_replace(chr(10), '', $str); $str = str_replace(chr(13), '', $str); $str = str_replace(' ', '', $str); $str = str_replace('\\', '\\\\', $str); $str = str_replace('"', '\\"', $str); $str = str_replace('\\\'', '\\\\\'', $str); $str = str_replace("'", "\'", $str); return $str; }
使用就不用說了··就是直接調(diào)用jsformat($str)
以上所述就是本文的全部內(nèi)容了,希望能對大家理解php轉(zhuǎn)義到j(luò)avascript有所幫助
請您花一點時間將文章分享給您的朋友或者留下評論。我們將會由衷感謝您的支持!

? 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)

N 1 ?? ??? ??? ?? ???? ?????? ?????? ?? ?? ????. 2. ???? ???? ???? ?? ??? ???????? ??? ??? ?? ? ??????. 3. ??? 2 ? ?? ?? Redis ?? ??? ?? ??? ?? ?? ??? ????? ??????. 4. ??? ????? ????? ????? Clear ()? ???? ???? ?????? ??? ????? ?????. 5. ?????? ??? ????? ???? ???? ? ??? ??? ?? ?? ? SQL ?? ??????. 6. ?? ??? ???? ?? ?????? ?? ?? ??? ?????? ?? ?? ?? ??? ???? ??? ??????. ORM? ???? ????? ?? ??? ????? ?? ???? ??? ???? ?? SQL ????, ??, ?? ?? ? ??? ???? ???????.

settings.json ??? ??? ?? ?? ?? ?? ?? ??? ??? VSCODE ??? ??? ???? ? ?????. 1. ??? ?? ?? : Windows? C : \ Users \\ AppData \ Roaming \ Code \ User \ Settings.json, MacOS IS /users//library/applicationsupport/code/user/settings.json, linux? /home//.config/code/user/settings.json; 2. Workspace ?? ?? : .vscode/settings project root ????

readOnlyPropertiesInphp8.2CanonlyBeassignedOnedOneDonceIntheConstructorAratDeclarationandCannotBemodififificificificifified

?? JavaScript? ???? ??? ??? ?? ??? ??? ??? ?? ??? ?? ??? ??? ???????. 1. HTML ???? ?? ???? ????? ??? ???? ????. 2. CSS ?? : ??? ?? ?? ??? ???? ?? ??, .dark-mode ???? ??? ?? ??? ???? var ()? ?? ??? ??? ?????. 3. JavaScript? ??? ???? ?? ???? ?? ??? ???? ?? LocalStorage? ????. 4. ??? ?? ? ? HTML ???? Dark-Mode ???? ???? ?? ??? LocalStorage? ?????. 5. ?? ?? ?? ??? 0.3 ? ?? ?????? ???? ???? ??????.

HTML? ???? ?? ??? ???? ?? ????? ???? ?? ??? ???????. ? ?? ??? ??? ???? ?????? ??? ???? ?????. 1. ??? ??? ????. 2. ? ?? ??? ??? ?????. 3. ????? ?? ? ??? ???? ?????. 4. ?? ??? ??? ?? ??? ? ????. 5. CSS? ?? ??? ?? ??? ???? ???, ?, ??? ?? ??? ?? ?? ???? ??????. ? ??? ???? ???? ?? ? ?? ??? ??????.

?? ?? ??? ???? ?? ??? ?? ?? ? ??? ???? VisualVM ?? JProfiler? ???? ?? ???? Async-Profiler? ?? ??? ?????. 2. ?? ??? ???, ??? ?????, StringBuilder? ???? ??? ? ??? ?? ????, ??? GC ??? ??????. 3. ??? ?? ?? ??? ????? ?? ??? ???? ?? ?????. 4. ??? ???, ?? ???? ????, ?? ???? ???, ??? ?? ????? ??????. 5. JVM ?? ?? ??, ???? ? ?? ? ?? ??? ???? ???? GC ??? ??????. 6. ?? ???? ??? ???, ?? ???? ?? ???? ???, ???? ?????, ?? ? ??? ??????. 7. JMH? ?? ? ???? ?? ??? ? ????

semantichtmlimprovesbothseoandaccessibility thatconvecontentstructure.1) itenhancesseothroughbetterconteralchywithproperheadgeelvels, intodindexingvialementsLikeAnd, andsupportforrrichsnippetsustustureddata.2) .2)

usetheelementwithinatocreateasemanticsearchfield.2
