您正在查看 "php技术" 分类下的文章 2010-12-27 14:58 linux下和以前一样
windows跟以往有点不同
1.#include <../main/config.w32.h>找不到
用win32/build下的config.w32.h.in改名即可
2. PHP Startup: aes: Unable to initialize module Module compiled with build ID=API20090626,TS PHP compiled with build ID=API20090626,TS,VC6 These options need to match 在config.w32.h里加入
#define PHP_COMPILER_ID "VC6" //保持一致
即可
3.用VS 来开发扩展的话,要做以下处理 |
2009-11-20 10:14 由于php不能动态修改类和对象的方法,实现aop就变得很困难。
尤其是用php开发webgame,如果能够运用aop,会降低维护成本。
网上看到过用__get, __set, __call来实现的办法。这个我以前也想过。但这种办法也有很大的缺点。如果能够用 runkit 扩展,就好很多了。下面是个用 runkit 来实现方法调用拦截的例子。
class Target {
function add($a, $b){
echo $a + $b."\n";
|
2009-09-24 10:13 一、安装xdebug模块
1、去www.xdebug.org下载相应版本php的模块文件,保存下载后的文件到php的ext目录,可以自己修改文件的名称,现在最新的版本是 2.0.1。
2、修改php.ini,增加如下信息
|
2009-07-27 11:02 Snoopy是一个php类,用来模拟浏览器的功能,可以获取网页内容,发送表单。
Snoopy 正确运行需要你的服务器的 PHP 版本在 4 以上,并且支持 PCRE(Perl Compatible Regular Expressions),基本的 LAMP 服务都支持。
下载snoopy
Snoopy的一些特点:
1抓取网页的内容 fetch
2 抓取网页的文本内容 (去除HTML标签) fetchtext
3抓取网页的链接,表单 fetchlinks fetchform
4 支持代理主机
5支持基 |
2009-06-19 15:10 来自织梦
$pinyins;
function SpGetPinyin($str,$ishead=0,$isclose=1)
{
global $pinyins;
$restr = '';
$str = trim($str);
$slen = strlen($str);
if($slen<2)
{
return $str;
}
if(count($pinyins)==0)
{
$fp = fopen(DEDEINC.'/data/pinyin.dat','r');
while(!feof($fp))
{
$line = trim(fgets($fp));
$pinyins[$line[0].$line[1] |
2009-06-19 14:30 php里实现汉字转区位码
// 汉字--区位码
if($t1!=""){
$t2= sprintf("%02d%02d",ord($t1[0])-160,ord($t1[1])-160);
//echo $t2;
}
// 区位码--汉字
if($t3!=""){
$t4 = chr(substr($t3,0,2)+160).chr(substr($t3,2,2)+160);
//echo $t4;
}
二元分词函数
function sp_str($str) {
//所有汉字后添加ASCII的0字符,此法是为了排除特殊中文拆分错误的问题
$str=preg_replace("/[\x80-\xff]{2}/"," |
2009-06-14 8:00 1.简介Database (dbm-style) Abstraction Layer
这些函数是建立在访问 Berkeley DB (伯克利数据库)的基础之上。
目前 PHP 支持的 DBA 数据库包括:
- dbm:柏克莱发展的最早期 DBA 数据库。
- ndbm:较新且较有弹性的 DBA。
- gdbm:GNU 发展的 DBA,ftp://ftp.gnu.org/pub/gnu/gdbm/
- db2:由 Slee
|
2009-06-14 7:59 1.简介
memcache模块是一个高效的守护进程,提供用于内存缓存的过程式程序和面向对象的方便的接口,特别是对于设计动态web程序时减少对数据库的访问。
memcache也提供用于通信对话(session_handler)的处理。
更多Memcache 模块相关信息可以到 http://www.danga.com/memcached/ 查阅。
1.1.memcache在php.ini中的配置项列表
|
2009-06-11 15:47 利用socket来实现文件上传,可以解决传统文件上传的诸多问题,并且是高效的。
服务器端代码:
<?php
set_time_limit(10);
$commonProtocol = getprotobyname("tcp");
$socket = socket_create(AF_INET, SOCK_STREAM, $commonProtocol);
if ($socket) {
$result = socket_bind($socket, '192.168.0.128', 1337);
if ($result) {
$result = socket_listen($socket, 5);
if ($result) {
echo "监听成功 |
2009-06-11 13:26 Windows下的Memcache安装:下载地址--http://jehiah.cz/projects/memcached-win32/
To install memcached as a service, follow the next steps:
- Unzip the binaries in your desired directory (eg. c:\memcached)
- Install the service using the command: 'c:\memcached\memcached.exe -d install' from either the command line
- Start the server from the Microsoft Management Console or by running the following command: 'c:\memcached\memcached.exe -d star
|
| | |