脚本宝典收集整理的这篇文章主要介绍了PHP的方括号:什么时候引用引号而什么时候不引用?,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
<htML> <head><tITle></title></head> <body> <?PHP if (isset ($_POST['posted'])) { if ($_POST['question1'] == "Lisbon") { echo "You are correct,$_POST[question1] is the right answer<hr>"; } if ($_POST['question1'] != "Lisbon") { echo "You are incorrect,$_POST[question1] is not. the right answer<hr>"; } } ?> <form method="POST" action="quiz.PHP"> <input tyPE="hidden" name="posted" value="true"> What is the capital of Portugal? <br> <br> <input name=''question1" type=''radio" value=''Porto''> Porto <br> <input name=''question1" type="radio" value=''Lisbon''> Lisbon <br> <input name="question1" type="radio" value=''Madrid''> Madrid <br> <br> <input type=''submit''> </form> </body> </html>
这是整个部分,它来自PDF.但事实上,他们没有说明为什么他们在if语句中使用”作为question1但在echo语句中没有使用引号.
简而言之:为什么$_POST [‘question1’]在if语句中有”
以及为什么$_POST [question1]在echo语句中没有.它们是同一个变量.
谢谢.
$juices = array("apple","orange","koolaid1" => "purple"); echo "He drank some $juices[0] juice.".PHP_EOL; echo "He drank some $juices[1] juice.".PHP_EOL; echo "He drank some juice made of $juice[0]s.".PHP_EOL; // Won't work echo "He drank some $juices[koolaid1] juice.".PHP_EOL;
以上是脚本宝典为你收集整理的PHP的方括号:什么时候引用引号而什么时候不引用?全部内容,希望文章能够帮你解决PHP的方括号:什么时候引用引号而什么时候不引用?所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。