批改状态:合格
老师批语:
<?php$str = "'cleam bread'";echo $str;echo '<hr>';// 使用反斜线引用字符串$test = addslashes($str);echo $test;echo '<hr>';// 反引用一个引用字符串 除反斜杠$test = stripslashes($test);echo $test;echo '<hr>';// 将特殊字符转换为 HTML 实体$test = htmlspecialchars($str);echo $test;echo '<hr>';// 将特殊的 HTML 实体转换回普通字符$test = htmlspecialchars_decode($test);echo $test;echo '<hr>';// 转义元字符集$test = quotemeta($str);echo $test;echo '<hr>';// 字符串转大写$str = "'abcde'";$test = strtoupper($str);echo $test;echo '<hr>';// 字符串转小写$str = "'ABCDE'";$test = strtolower($str);echo $test;echo '<hr>';//使用uuencode编码一个字符串$str ="'hello'";$bianmazfc = convert_uuencode($str);echo $bianmazfc;echo '<br>';echo '<hr>';$bianmazfc = convert_uudecode($bianmazfc);echo $bianmazfc;echo '<hr>';// 数组转换成字符串$arr = ['巧克力','饼干','100g','2021',];echo implode('--',$arr);echo '<hr>';// 把字符串分割成数组$str = '巧克力面包0冰淇淋蛋糕1曲奇饼干';print_r( explode ('0',$str));echo '<hr>';//地址引用$a = '巧克力';$b = &$a;echo $a;echo '<hr>';echo $b;echo '<hr>';$a = '全麦面包';echo $a;echo '<hr>';echo $b;?>
<?php$a = 10;$b = 5;$c = $a<$b ? ('面包'):('巧克力');echo '$c =' .$c;?>
<?php// date>19 echo“烤羊肉”,date<19 echo“杏仁豆腐”$t=date('d');if ($t>"19") {echo "杏仁豆腐!";}else{echo '烤羊肉';}?><?php// if 多条件判断$food = '';if($food == '糕点'){echo '桃花酥';}else if($food == '面包'){echo '海盐面包';}else if($food != '巧克力'){echo '喜欢';}else{echo '不喜欢';}?>
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号