<meta charset="utf-8">
<?php
echo $str = <<< DOC
<table border="1">
<tr>
<th>姓名</th>
<th>班级</th>
<th>年龄</th>
</tr>
<tr>
<td>张三</td>
<td>三年二班</td>
<td>12</td>
</tr>
<tr>
<td>李四</td>
<td>六年一班</td>
<td>11</td>
</tr>
</table>
DOC;
?>
<?php
echo $str = <<< DOC
<table border="1">
<tr>
<th>姓名</th>
<th>班级</th>
<th>年龄</th>
</tr>
<tr>
<td>张三</td>
<td>三年二班</td>
<td>12</td>
</tr>
<tr>
<td>李四</td>
<td>六年一班</td>
<td>11</td>
</tr>
</table>
DOC;
?>
2017-10-10
<?php
$str ='abcdefghijklnmopqrstuvwxyzABCDEFGHJIKLMNOPQRSTUVWXYZ0123456789';
$string=null;
for ($i=0; $i <4 ; $i++){
$string.= $str[mt_rand(0,strlen($str)-1)];
}
echo $string;
echo '<br/>';
echo strlen($str);
?>
$str ='abcdefghijklnmopqrstuvwxyzABCDEFGHJIKLMNOPQRSTUVWXYZ0123456789';
$string=null;
for ($i=0; $i <4 ; $i++){
$string.= $str[mt_rand(0,strlen($str)-1)];
}
echo $string;
echo '<br/>';
echo strlen($str);
?>
2017-10-10
// 随机输出4位由数字、大小写字母组成的字符
function str_random() {
$str = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
for ($i=0;$i<4;$i++) {
echo $str{mt_rand(0,strlen($str)-1)};
}
}
str_random();
function str_random() {
$str = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
for ($i=0;$i<4;$i++) {
echo $str{mt_rand(0,strlen($str)-1)};
}
}
str_random();
2017-09-01