简单的mysql数据表结构
CREATE TABLE messages
(
msg_id INT PRIMARY KEY AUTO_INCREMENT,
message VARCHAR(150)
);
简单的mysql数据表结构
CREATE TABLE messages
(
msg_id INT PRIMARY KEY AUTO_INCREMENT,
message VARCHAR(150)
);
汉字转换成unicode方法
<?php
//将utf8编码的汉字转换为unicode
function htou($c){
$n = (ord($c[0]) & 0x1f) << 12;
$n = (ord($c[1]) & 0x3f) << 6;
$n = ord($c[2]) & 0x3f;
return $n;
}
1) 修改 php 扩展代码以兼容支持 php 5.4.x
2) 修正 php 扩展中 scws_get_tops 的 limit 参数不允许少于 10 的问题
3) libscws 增加 scws_fork() 从既有的 scws 实例产生分支并共享词典/规则集,主要用于多线程开发。
4) 新增部分版本的 win32 的 dll 扩展
方法一:
用serialize写入,再用unserialize输出
利用以上汉字与英文的差异,我们就可以利用mb_strlen函数与strlen函数分别计算出两组长度数字,然后根据规律进行运算即可判断出字符串的类型了
先讲一下strlen与mb_strlen是求字符串长度的函数
1,不做总长度判断,长度判断可以自己加上;
2,支持.net.cn,.com.cn这样的域名后缀;
<?php
/**
* PHP获取一组随机数字不重复
*/
$a = microtime();
function createRandID($m){
// 产生一个从1到$m的数组
$arr = range(1,$m);
// 打乱数组
shuffle ($arr);
// 取前十个
for($i=0;$i<=10;$i++){
// 赋值给新数组$n
$n[] = $arr[$i];
}
// 返回这组数字
return implode($n,',');
}
echo createRandID(700000);
echo '<br />';
echo $a - microtime();
?>
假如脚本路径下有如下文件
-bash-4.1# ll
总用量 12
-rw-rw-r--. 1 www web 133 7月 16 15:00 a.php
-rw-r--r--. 1 lee web 59 2月 29 17:05 b.php
-rw-r--r--. 1 lee web 81 3月 8 17:00 c.php
ob_start ob_get_flush 这些函数是缓存技术的一种,是减轻服务器压力的,直到项目开发用到才知道混淆了和缓存的概念,
这些像ob_start ob_get_flush这些函数都是为了在编程中字符串输出到客户端上去为了延长时间而用到的技术,延迟输出(字符串先发送到缓冲区需要时在输出到浏览器),是一种输出技巧。最常见的应用是静态化技术(可以实现静态缓存):
将winntphp.ini-dist改名为php.ini,并找到;Windows Extensions项将
;extension=php_ldap.dll
se.php
<?php
$city = $_GET['city'];
$data = createXml($city);
$xml = simplexml_load_string($data);
header("Content-type: text/xml");
echo $xml->asXML();
// 生成XML数据
function createXml($city)
{
// Google 天气API
$weather = simplexml_load_file("http://www.google.com/ig/api?weather={$city}");
if(isset($weather->weather->forecast_conditions))
{
$low = f2c($weather->weather->forecast_conditions->low['data']);
$high = f2c($weather->weather->forecast_conditions->high['data']);
return "<weather>n<city>{$city}</city>n<low>{$low}</low>n<high>{$high}</high></weather>n";
}
else
{
return "<weather>n</weather>n";
}
}
// 华氏度转摄氏度
function f2c($fahrenhite)
{
return floor(($fahrenhite - 32) / 1.8);
}
//计算数组的合并 array_merge与“+”的区别
array_merge() 函数把两个或多个数组合并为一个数组。
如果键名有重复,该键的键值为最后一个键名对应的值(后面的覆盖前面的)。如果数组是数字索引的,则键名会以连续方式重新索引。