易截截图软件、单文件、免安装、纯绿色、仅160KB

PHP生成随机字符串的方法

Code:
<?php
function genRandomString($len)
{
$chars = array(
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", 
"l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", 
"w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", 
"H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", 
"S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2", 
"3", "4", "5", "6", "7", "8", "9"
);
$charsLen = count($chars) - 1;
shuffle($chars);    // 将数组打乱
$output = "";
for ($i=0; $i<$len; $i++)
{
$output .= $chars[mt_rand(0, $charsLen)];
}
return $output;
}
$str = genRandomString(4); //输入要输入的随机数的个数;
$str .= "<br />";
$str .= genRandomString(4);
$str .= "<br />";
$str .= genRandomString(4);
echo $str;
?>


相关文档:

PHP+Ajax实现Tab效果

用Ajax实现Tab效果的
先创建
ajax.php,在其中输入如下代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Sample 2_1</title>
<me ......

PHP与MySQL开发中的字符编码问题

一.关于MySQL数据库服务器
MySQL服务器的默认编码是Latin1,不支持中文,那么如何修改MySQL的默认编码呢,下面以UTF-8为例来说明。
1、中止MySQL服务(bin/mysqladmin -u root shutdown)
2、在/etc/下找到my.cnf,如果没有就把MySQL的安装目录下的support-files目录下的my-medium.cnf复制到/etc/下并改名为my.cnf即可 ......

php表格(test)

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <style type = "text/css">
        &nbs ......

PHP验证码生成脚本(5位数字png格式)


<?php
header("Content-Type:image/png");
srand((double)microtime()*1000000);
$img_height=20;
$img_width=60;
$im=@imagecreate($img_width,$img_height) or die("不能初始化GD文件流");
$background_color=imagecolorallocate($im,255,255,255);
$text_color=imagecolorallocate($im,233,14,91);
......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号