本文共 492 字,大约阅读时间需要 1 分钟。
";//总循环while($line <= $total_line){ //空格数计算 $empty = $total_line - $line; //星数计算 $star = 2 * $line - 1; //空格当前位置 $empty_pos = 1; //星当前位置 $star_pos = 1; echo ""; //输出空格 while($empty_pos <= $empty) { echo " "; $empty_pos++; } //输出星 while($star_pos <= $star) { echo "*"; $star_pos++; } //输出对称面空格 while($empty_pos >= 1) { echo " "; $empty_pos--; } echo ""; //当前行后移 $line++;}echo "";
转载地址:http://apem.baihongyu.com/