php获取原图片
<?php
/*
获取远程图片函数
*/
function GrabImage($url,$filename=""){
//若url为空返回false,无地址
if($url=="") return false;
//若$filename为空
if($filename=="") {
$ext=strrchr($url,"."); //获取"."加后缀
if($ext!=".gif"&&$ext!=".jpg"&&$ext!=".png") return false;
$filename=date("YmdHis").$ext;
}
ob_start();
readfile($url);
$img = ob_get_contents();
ob_end_clean();
$size = strlen($img);
$fp2=@fopen($filename,"a");
fwrite($fp2,$img);
fclose($fp2);
return $filename;
}
$img=GrabImage("http://www.google.com/intl/en_ALL/images/logo.gif","logo.gif");
if($img){
echo '<img src="'.$img.'" mce_src="'.$img.'">';
}else{
echo "false";
}
?>
相关文档:
http://hi.baidu.com/fish124423/blog/item/c6f9f310190dd779ca80c456.html解决error trying access httpd. conf file.you will need to manually configure the的配置问题
Apache+mysql+php在windows下的配置(成功)
2008-12-16 14:49
Apche下载地点:http://www.apache/org
Or http://www.51cto.com/html/ ......
通讯录已经大致完成了,但如果记录数多时,查找起来很不方便,如果加一个搜索功能就好了。今天我们就来制作一个搜索功能
在Index.php合适的地方加入搜索框
<!---搜索框--->
<!--这里的所有值前面加前缀“S_”以区分-->
<form id="form1" name="form1" method="post" action="Search.php ......
昨天我们实现了一个简单的搜索功能,今天我想了一下,其实还有可以改进的地址,如直接用Index.php代替Search.php。
修改Index.php文件,修改一下搜索表单
<!---搜索框--->
<!--这里的所有值前面加前缀“S_”以区分-->
<form id="form1" name="form1" method="get" action="Index.php">
&n ......
is_int函数对于FORM过来的数据是没有办法判断是否是整数的,因为FORM过来的是字符串。用is_numeric可以判断是否为数字类型,稍动 下手脚就可以判断是不是整数了
if(!is_numeric($jp_total)||strpos($jp_total,".")!==false){
echo "不是整数";
}else{
echo "是整数";
} ......
1. PHP可阅读随机字符串
此代码
将创建一个可阅读的字符串,使其更接近词典中的单
词,实用且具有密码验证功能。
/**************
[email=*@length]*@length[/email] - length of random string (must be a
multiple of 2)
**************/
function readable_random_string($length = 6){
$conso= ......