function do_call($host,$port,$request) //定义函数
{
$fp=fsockopen($host,$port,$errno,$errstr);
$query="post /default/php教程/server.php http/1.0nuser_agent:this is a dummy clientnhost:".
$host."ncontent-type:text/xmlncontent-length:".
strlen($request)."nn".$request."n";
if(!fputs($fp,$query,strlen($query)))
{
$errstr="write error";
return 0;
}
$contents='';
while(!feof($fp))
{
$contents.=fgets($fp);
}
fclose($fp);
return $contents;
}
$host='localhost'; //定义host地址
$port=80; //定义端口
$obj->type="datetime"; //定义对象
$obj->scalar="20040420t13:32:40";
$obj->timestamp=1082460760;
$request=xmlrpc_encode_request('dummyserver',$obj); //为php生成xml
$response=do_call($host,$port,$request); //调用函数
$xmlrpctype=xmlrpc_get_type($response); //获取xmlrpc类型
print_r($xmlrpctype); //输出结果?>
php hypot()直角三角形斜边长度 is_infinite()是否为无限值
定义和用法
is_infinite() 判断是否为无限值。
语法
is_infinite(x)参数 描述
x 必需。规定要检查的值。
php get_cfg_var 取得 PHP 的配置
取得 php教程 的配置选项值。
语法: string get_cfg_var(string varname);
高手检查和调优mysql性能方法(1/6)
我一直是使用mysql教程这个数据库教程软件,它工作比较稳定,效率也很高。在遇到严重性能问题时,一般都有这么几种可能:
1、索引没有建好;
2、sql写法过于复杂;
3、配置错误;
4、机器实在负荷不了;
完整php ajax用户注册与用户名验证实例
<!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title>insert title here</title>
<script type="text/网页特效">
function checkusername(input){
var name = input.value;
var url = 'checkusername.php教程?username=' + name;
round() 函数对浮点数进行四舍五入
语法
round(x,prec)参数 描述
x 可选。规定要舍入的数字。
prec 可选。规定小数点后的位数。
说明
返回将 x 根据指定精度 prec (十进制小数点后数字的数目)进行四舍五入的结果。prec 也可以是负数或零(默认值)。
提示和注释
注释:php教程 默认不能正确处理类似 "12,300.2" 的字符串。
php session 处理类
php教程 session 变量用于存储有关用户会话的信息,或更改用户会话的设置。session 变量保存的信息是单一用户的,并且可供应用程序中的所有页面使用。
php session 变量
当您运行一个应用程序时,您会打开它,做些更改,然后关闭它。这很像一次会话。计算机清楚你是谁。它知道你何时启动应用程序,并在何时终止。但是在因特网上,存在一个问题:服务器不知道你是谁以及你做什么,这是由于 http 地址不能维持状态。
php imagettftext 为文字添加阴影实例
array imagettftext ( resource image, int size, int angle, int x, int y, int color, string fontfile, string text)
imagettftext() 将字符串 text 画到 image 所代表的图像上,从坐标 x,y(左上角为 0, 0)开始,角度为 angle,颜色为 color,使用 fontfile 所指定的 truetype 字体文件。根据 php教程 所使用的 gd 库的不同,如果 fontfile 没有以 '/'开头,则 '.ttf' 将被加到文件名之后并且会搜索库定义字体路径。
php imagefilledrectangle在图片画一矩形并填充
//发送头文件
header("content-type: image/png");
//创建真彩色图像
$im=imagecreatetruecolor(100,50);
//定义黑色
$black=imagecolorallocate($im,0,0,0);
//定义白色
$white=imagecolorallocate($im,255,255,255);
//画一矩形并填充
imagefilledrectangle($im,0,0,99,49, $white);
//定义字体
imagestring($im,2,0,0,"hello",$black);
//输出图像
imagepng($im);
/*
执行该代码将生成一幅png图像,并在图像上显示hello。
完整的新闻无限级分类代码,可添加,删除,移动,修改
php 图形处理函数imagetype
php教程 图形处理函数imagetypes() imagecreatetruecolor() imagecreate()
//判断当前的gd库是否支持png
本函数以比特字段方式返回与当前 php 版本关联的 gd 库所支持的图像格式。将返回以下结果,img_gif | img_jpg | img_png | img_wbmp| img_xpm。 例如要检查是否支持 png
php function_exists判断函数可用代码
$values=array(
40,50, //第一个顶点的坐标
20,240, //第一个顶点的坐标
60,60, //第一个顶点的坐标
240,20, //第一个顶点的坐标
50,40, //第一个顶点的坐标
10,10 //第一个顶点的坐标
);
$im=imagecreatetruecolor(250,250); //创建图像
$bg=imagecolorallocate($im,200,200,200); //定义灰色背景
$yellow=imagecolorallocate($im,255,255,0); //定义黄色前景
imagefilledpolygon($im,$values,6,$yellow); //画出多边形
header('content-type: image/png');
//判断gif函数是否存在
if(function_exists("imagegif"))
{
//如果存在,以gif格式输出
header("content-type: image/gif");
imagegif($im);
}
//判断jpeg函数是否存在
elseif(function_exists("imagejpeg"))
{
//如果存在,以jpg格式输出
header("content-type: image/jpeg");
imagejpeg($im, "", 0.5);
}
//判断png函数是否存在
elseif (function_exists("imagepng"))
{
//如果存在,以png格式输出
header("content-type: image/png");
imagepng($im);
}
//判断wbmp函数是否存在
elseif (function_exists("imagewbmp"))
{
//如果存在,以bmp格式输出
header("content-type: image/vnd.wap.wbmp");
/*
header() 函数向客户端发送原始的 http 报头。