PHP入門レベルコード

35689 ワード

例1:最初のPHPプログラム xmlns="http://www.w3.org/1999/xhtml"> http-equiv="Content-Type"content="text/html; charset=utf-8"/> </span><span class="pln" style="color:#48484c;"> PHP </span><span class="tag" style="color:#000088;"/></code></li> <li class="L5" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"/></code></li> <li class="L6" style="margin-left:0px;color:#bebec5;line-height:18px;"><code/></li> <li class="L7" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"/></code></li> <li class="L8" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="pun" style="color:#93a1a1;"/><span class="pln" style="color:#48484c;">php</span></code></li> <li class="L9" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="pln" style="color:#48484c;">echo </span><span class="str" style="color:#dd1144;">" PHP "</span><span class="pun" style="color:#93a1a1;">;</span></code></li> <li class="L0" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="pun" style="color:#93a1a1;">?></span></code></li> <li class="L1" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"/></code></li> <li class="L2" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"/></code></li> </ol> </div> <div> <span style="line-height:1.6;"> :</span> </div> <div> <a href="https://img.md5.com/image/info8/01e151a6352c43e5a31ab2781cd56cad.jpg" target="_blank"><img src="https://s1.md5.ltd/image/58b0b8c643379feae3b01bccfbe6be93.jpg" alt="PHP _ 1 " width="650" height="241" style="border:1px solid black;" class="check_url_is_full"/></a> <br/>  </div> <div> <div>   </div> <div> 2: </div> <div> <div> <ol class="linenums" style="color:#1e347b;"> <li class="L0" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="dec" style="color:#008080;"/></code></li> <li class="L1" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"><span class="atn" style="color:#008080;">xmlns</span><span class="pun" style="color:#93a1a1;">=</span><span class="atv" style="color:#dd1144;">"http://www.w3.org/1999/xhtml"</span><span class="tag" style="color:#000088;">></span></span></code></li> <li class="L2" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"/></code></li> <li class="L3" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"><meta/><span class="atn" style="color:#008080;">http-equiv</span><span class="pun" style="color:#93a1a1;">=</span><span class="atv" style="color:#dd1144;">"Content-Type"</span><span class="atn" style="color:#008080;">content</span><span class="pun" style="color:#93a1a1;">=</span><span class="atv" style="color:#dd1144;">"text/html; charset=utf-8"</span><span class="tag" style="color:#000088;">/></span></span></code></li> <li class="L4" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"><title/></span><span class="pln" style="color:#48484c;"> </span><span class="tag" style="color:#000088;"/></code></li> <li class="L5" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"/></code></li> <li class="L6" style="margin-left:0px;color:#bebec5;line-height:18px;"><code/></li> <li class="L7" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"/></code></li> <li class="L8" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"><p><span class="atn" style="color:#008080;">style</span><span class="pun" style="color:#93a1a1;">=</span><span class="atv" style="color:#dd1144;">"</span><span class="pln" style="color:#48484c;">margin</span><span class="pun" style="color:#93a1a1;">-</span><span class="pln" style="color:#48484c;">top</span><span class="pun" style="color:#93a1a1;">:</span><span class="lit" style="color:#195f91;">10px</span><span class="pun" style="color:#93a1a1;">;</span><span class="pln" style="color:#48484c;">margin</span><span class="pun" style="color:#93a1a1;">-</span><span class="pln" style="color:#48484c;">left</span><span class="pun" style="color:#93a1a1;">:</span><span class="lit" style="color:#195f91;">180px</span><span class="atv" style="color:#dd1144;">"</span><span class="tag" style="color:#000088;">></span></p></span></code></li> <li class="L9" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="pun" style="color:#93a1a1;"/><span class="pln" style="color:#48484c;">php</span></code></li> <li class="L0" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="pln" style="color:#48484c;">echo </span><span class="str" style="color:#dd1144;">"<font color="#11ffff00"> :"</font></span><span class="pun" style="color:#93a1a1;">.</span><span class="pln" style="color:#48484c;">date</span><span class="pun" style="color:#93a1a1;">(</span><span class="str" style="color:#dd1144;">"Y-m-d H:i:s "</span><span class="pun" style="color:#93a1a1;">).</span><span class="str" style="color:#dd1144;">""</span></code></li> <li class="L1" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="pun" style="color:#93a1a1;">?></span></code></li> <li class="L2" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"/></code></li> <li class="L3" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"/></code></li> </ol> </div> </div> <div> : </div> <div> <a href="https://img.md5.com/image/info8/fa0dd6ad4145431baa4ef069ff1bac74.jpg" target="_blank"><img src="https://s1.md5.ltd/image/65a4d78e765b7c9cf31f5273236113bf.jpg" alt="PHP _ 2 " width="650" height="241" style="border:1px solid black;" class="check_url_is_full"/></a> <br/>  </div> <div> : </div> <div> php.ini 。 </div> <div> <div> [Date] </div> <div> ; Defines the default timezone used by the date functions </div> <div> ; http://php.net/date.timezone </div> <div> date.timezone ="Asia/Hong_Kong" </div> </div> <div> Apache , 。 </div> <div>   </div> <div> 3: </div> <div> <div> <ol class="linenums" style="color:#1e347b;"> <li class="L0" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="dec" style="color:#008080;"/></code></li> <li class="L1" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"><span class="atn" style="color:#008080;">xmlns</span><span class="pun" style="color:#93a1a1;">=</span><span class="atv" style="color:#dd1144;">"http://www.w3.org/1999/xhtml"</span><span class="tag" style="color:#000088;">></span></span></code></li> <li class="L2" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"/></code></li> <li class="L3" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"><meta/><span class="atn" style="color:#008080;">http-equiv</span><span class="pun" style="color:#93a1a1;">=</span><span class="atv" style="color:#dd1144;">"Content-Type"</span><span class="atn" style="color:#008080;">content</span><span class="pun" style="color:#93a1a1;">=</span><span class="atv" style="color:#dd1144;">"text/html; charset=utf-8"</span><span class="tag" style="color:#000088;">/></span></span></code></li> <li class="L4" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"><title/></span><span class="pln" style="color:#48484c;"> </span><span class="tag" style="color:#000088;"/></code></li> <li class="L5" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"/></code></li> <li class="L6" style="margin-left:0px;color:#bebec5;line-height:18px;"><code/></li> <li class="L7" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"/></code></li> <li class="L8" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="pun" style="color:#93a1a1;"/><span class="pln" style="color:#48484c;">php</span></code></li> <li class="L9" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="pln" style="color:#48484c;">echo </span><span class="str" style="color:#dd1144;">"PHP "</span><span class="pun" style="color:#93a1a1;">;</span></code></li> <li class="L0" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="pun" style="color:#93a1a1;">?></span></code></li> <li class="L1" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"/></code></li> <li class="L2" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"/></code></li> </ol> </div> </div> <div> : </div> <div> <a href="https://img.md5.com/image/info8/db0494e416e5476e8fbcf8db0812a62e.jpg" target="_blank"><img src="https://s1.md5.ltd/image/11c5dcf1d63f554b4aa739d1bb601df1.jpg" alt="PHP _ 3 " width="650" height="241" style="border:1px solid black;" class="check_url_is_full"/></a> <br/>  </div> <div>   </div> <div> 4: </div> <div> <div> <ol class="linenums" style="color:#1e347b;"> <li class="L0" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="dec" style="color:#008080;"/></code></li> <li class="L1" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"><span class="atn" style="color:#008080;">xmlns</span><span class="pun" style="color:#93a1a1;">=</span><span class="atv" style="color:#dd1144;">"http://www.w3.org/1999/xhtml"</span><span class="tag" style="color:#000088;">></span></span></code></li> <li class="L2" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"/></code></li> <li class="L3" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"><meta/><span class="atn" style="color:#008080;">http-equiv</span><span class="pun" style="color:#93a1a1;">=</span><span class="atv" style="color:#dd1144;">"Content-Type"</span><span class="atn" style="color:#008080;">content</span><span class="pun" style="color:#93a1a1;">=</span><span class="atv" style="color:#dd1144;">"text/html; charset=utf-8"</span><span class="tag" style="color:#000088;">/></span></span></code></li> <li class="L4" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"><title/></span><span class="pln" style="color:#48484c;"> </span><span class="tag" style="color:#000088;"/></code></li> <li class="L5" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"/></code></li> <li class="L6" style="margin-left:0px;color:#bebec5;line-height:18px;"><code/></li> <li class="L7" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"/></code></li> <li class="L8" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="pun" style="color:#93a1a1;"/><span class="pln" style="color:#48484c;">php</span></code></li> <li class="L9" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="pln" style="color:#48484c;"> echo </span><span class="str" style="color:#dd1144;">' '</span></code></li> <li class="L0" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="pun" style="color:#93a1a1;">?></span></code></li> <li class="L1" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"/></code></li> <li class="L2" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"/></code></li> </ol> </div> <div> <span style="line-height:1.6;"> :</span> </div> </div> <div> <a href="https://img.md5.com/image/info8/6b598c119ae043469466dbc14b423279.jpg" target="_blank"><img src="https://s1.md5.ltd/image/9eaaf45a3aacd3f4f0ad7189eb8ef0e1.jpg" alt="PHP _ 4 " width="650" height="407" style="border:1px solid black;" class="check_url_is_full"/></a> <br/>  </div> <div>   </div> <div> 5: </div> <div> <div> <ol class="linenums" style="color:#1e347b;"> <li class="L0" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="dec" style="color:#008080;"/></code></li> <li class="L1" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"><span class="atn" style="color:#008080;">xmlns</span><span class="pun" style="color:#93a1a1;">=</span><span class="atv" style="color:#dd1144;">"http://www.w3.org/1999/xhtml"</span><span class="tag" style="color:#000088;">></span></span></code></li> <li class="L2" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"/></code></li> <li class="L3" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"><meta/><span class="atn" style="color:#008080;">http-equiv</span><span class="pun" style="color:#93a1a1;">=</span><span class="atv" style="color:#dd1144;">"Content-Type"</span><span class="atn" style="color:#008080;">content</span><span class="pun" style="color:#93a1a1;">=</span><span class="atv" style="color:#dd1144;">"text/html; charset=utf-8"</span><span class="tag" style="color:#000088;">/></span></span></code></li> <li class="L4" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"><title/></span><span class="pln" style="color:#48484c;"> </span><span class="tag" style="color:#000088;"/></code></li> <li class="L5" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"/></code></li> <li class="L6" style="margin-left:0px;color:#bebec5;line-height:18px;"><code/></li> <li class="L7" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"/></code></li> <li class="L8" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="pun" style="color:#93a1a1;"/><span class="pln" style="color:#48484c;">php </span></code></li> <li class="L9" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="pln" style="color:#48484c;">echo </span><span class="str" style="color:#dd1144;">" "</span><span class="pun" style="color:#93a1a1;">;</span></code></li> <li class="L0" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="pun" style="color:#93a1a1;">?></span></code></li> <li class="L1" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"/></code></li> <li class="L2" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"/></code></li> </ol> </div> <div> <span style="line-height:1.6;"> :</span> </div> </div> <div> <span style="line-height:1.6;"><a href="https://img.md5.com/image/info8/c3e9e7b4378d4a7aa44183c67004f095.jpg" target="_blank"><img src="https://s1.md5.ltd/image/ac36d8b5844958dfddd57fb2128c7e56.jpg" alt="PHP _ 5 " width="650" height="201" style="border:1px solid black;" class="check_url_is_full"/></a><br/> </span> </div> <div>   </div> <div> 6: </div> </div> <div> <div> <ol class="linenums" style="color:#1e347b;"> <li class="L0" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="dec" style="color:#008080;"/></code></li> <li class="L1" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"><span class="atn" style="color:#008080;">xmlns</span><span class="pun" style="color:#93a1a1;">=</span><span class="atv" style="color:#dd1144;">"http://www.w3.org/1999/xhtml"</span><span class="tag" style="color:#000088;">></span></span></code></li> <li class="L2" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"/></code></li> <li class="L3" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"><meta/><span class="atn" style="color:#008080;">http-equiv</span><span class="pun" style="color:#93a1a1;">=</span><span class="atv" style="color:#dd1144;">"Content-Type"</span><span class="atn" style="color:#008080;">content</span><span class="pun" style="color:#93a1a1;">=</span><span class="atv" style="color:#dd1144;">"text/html; charset=utf-8"</span><span class="tag" style="color:#000088;">/></span></span></code></li> <li class="L4" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"><title/></span><span class="pln" style="color:#48484c;"> </span><span class="tag" style="color:#000088;"/></code></li> <li class="L5" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"/></code></li> <li class="L6" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"/></code></li> <li class="L7" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"><p><span class="atn" style="color:#008080;">style</span><span class="pun" style="color:#93a1a1;">=</span><span class="atv" style="color:#dd1144;">"</span><span class="pln" style="color:#48484c;">margin</span><span class="pun" style="color:#93a1a1;">-</span><span class="pln" style="color:#48484c;">top</span><span class="pun" style="color:#93a1a1;">:</span><span class="lit" style="color:#195f91;">10px</span><span class="pun" style="color:#93a1a1;">;</span><span class="pln" style="color:#48484c;">margin</span><span class="pun" style="color:#93a1a1;">-</span><span class="pln" style="color:#48484c;">left</span><span class="pun" style="color:#93a1a1;">:</span><span class="lit" style="color:#195f91;">180px</span><span class="atv" style="color:#dd1144;">"</span><span class="tag" style="color:#000088;">></span></p></span></code></li> <li class="L8" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="pun" style="color:#93a1a1;"/><span class="pln" style="color:#48484c;">php</span></code></li> <li class="L9" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="pln" style="color:#48484c;">echo </span><span class="str" style="color:#dd1144;">"<font color="#11FF00"> , !"</font></span><span class="pun" style="color:#93a1a1;">.</span><span class="str" style="color:#dd1144;">"["</span><span class="pun" style="color:#93a1a1;">.</span><span class="pln" style="color:#48484c;">date</span><span class="pun" style="color:#93a1a1;">(</span><span class="str" style="color:#dd1144;">"Y-m-d H:i:s"</span><span class="pun" style="color:#93a1a1;">).</span><span class="str" style="color:#dd1144;">"]"</span><span class="pun" style="color:#93a1a1;">;</span></code></li> <li class="L0" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="pun" style="color:#93a1a1;">?></span></code></li> <li class="L1" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"/></code></li> <li class="L2" style="margin-left:0px;color:#bebec5;line-height:18px;"><code><span class="tag" style="color:#000088;"/></code></li> </ol> </div> <div> <span style="line-height:1.6;"> :</span> </div> </div> </div> <div style="font-family:Helvetica, 'Hiragino Sans GB', ' ', 'Microsoft YaHei UI', SimSun, SimHei, arial, sans-serif;font-size:15px;line-height:24px;"> <a href="https://img.md5.com/image/info8/fca4a1538e7f40169e277db7e606ce9f.jpg" target="_blank"><img src="https://s1.md5.ltd/image/9e26ff14ce750ed0e0eb30dc069cbc1e.jpg" alt="PHP _ 6 " width="650" height="201" style="border:1px solid black;" class="check_url_is_full"/></a> <br/>  </div> </div> <div class="attachments"> <ul style="display:none;"> <li><a href="https://img.md5.com/image/info8/a2315f4e8b4d42dc8e5242c2b5db5acb.jpg" target="_blank"><img src="https://s1.md5.ltd/image/464dfa56dbd76a1483a56c147e4d803d.jpg" class="check_url_is_full" title=" " alt="PHP _ 7 " width="200" height="150" style="border:1px solid black;"/></a></li> <li> : 25.7 KB</li> </ul> <ul style="display:none;"> <li><a href="https://img.md5.com/image/info8/a4928730f474436fba1963f8ad9ab26d.jpg" target="_blank"><img src="https://s1.md5.ltd/image/8f194c850aa9aba78c3808b7f0fad424.jpg" class="check_url_is_full" title=" " alt="PHP _ 8 " width="200" height="150" style="border:1px solid black;"/></a></li> <li> : 25.9 KB</li> </ul> <ul style="display:none;"> <li><a href="https://img.md5.com/image/info8/c9bbb147aab74caca2ac0774d2d00481.jpg" target="_blank"><img src="https://s1.md5.ltd/image/80df789cba6b548c103f76e97cf7c0c7.jpg" class="check_url_is_full" title=" " alt="PHP _ 9 " width="200" height="150" style="border:1px solid black;"/></a></li> <li> : 25.7 KB</li> </ul> <ul style="display:none;"> <li><a href="https://img.md5.com/image/info8/79d1b4b8d0004181b09ebdee0a18f9a0.jpg" target="_blank"><img src="https://s1.md5.ltd/image/ee2958be8568b46c6b8fa9e72075a05a.jpg" class="check_url_is_full" title=" " alt="PHP _ 10 " width="200" height="150" style="border:1px solid black;"/></a></li> <li> : 80.9 KB</li> </ul> <ul style="display:none;"> <li><a href="https://img.md5.com/image/info8/a804275dcd604e1a985aede91e24d94e.jpg" target="_blank"><img src="https://s1.md5.ltd/image/01537222bf9b8dd626ec34e302542488.jpg" class="check_url_is_full" title=" " alt="PHP _ 11 " width="200" height="150" style="border:1px solid black;"/></a></li> <li> : 25.5 KB</li> </ul> <ul style="display:none;"> <li><a href="https://img.md5.com/image/info8/8b0185e568de496781abc4303166c91d.jpg" target="_blank"><img src="https://s1.md5.ltd/image/e65c0b979b46fbb84a4e235f31989588.jpg" class="check_url_is_full" title=" " alt="PHP _ 12 " width="200" height="150" style="border:1px solid black;"/></a></li> <li> : 27.2 KB</li> </ul> <ul> <li> </li> </ul> </div> </div> </div> </div> </div>