精華區beta Electronics 關於我們 聯絡資訊
自問自答一下 要在網頁上執行斷行,原來是要用<br>才可以 所以print "\n" 要改成 print "<br>" 不過有人可以解釋嗎? 像php這種專門用在網頁的語言,為捨遇到\n,編譯器不會直接轉啊? =.= ※ 引述《adddream (哆啦A孟)》之銘言: : <html> : <title>PHP hello</title> : <head></head> : <body> : <?php : $price = 3.95; : $tax_rate = 0.08; : $tax_amount = $price * $tax_rate; : $tatal_cost = $price + $tax_amount; : $username = 'james'; : $domain = '@example.com'; : $email_address = $username .$domain; : print 'the tax is ' .$tax_amount; : print "\n\n"; : print 'the total cost is ' .$total_cost; : print "\n\n"; : print $email_address; : ?> : </body> : </html> : 以上,執行結果是 the tax is 0.316 the total cost is 4.266000 james@example.com : 很怪,因為我有加入"\n" 去空行啊 ? 怎麼會有這麼奇怪的結果 : 請各位幫幫忙啊 ^^ ~~ : PS:系統是linux -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.122.79.88
Ohwil:有PHP版 03/06 14:51