获取图像信息 getimagesize()
array getimagesize ( string $filename [, array &$imageinfo ] )
#本地图片
<?php
list($width, $height, $type, $attr) = getimagesize("runoob-logo.png");
echo "宽度为:" . $width;
echo "高度为:" . $height;
echo "类型为:" . $attr;
?>
#远程图片
<?php
$remote_png_url = 'http://www.runoob.com/wp-content/themes/w3cschool.cc/assets/img/logo-domain-green2.png';
$img_data = getimagesize($remote_png_url);
print_r($img_data );
?>
Array
(
[0] => 290 //宽
[1] => 69 //高
[2] => 3
[3] => width="290" height="69"
[bits] => 8
[mime] => image/png
)
去除数组中重复的元素值 array_unique($array)
<?php
$a=array("a"=>"Cat","b"=>"Dog","c"=>"Cat");
print_r(array_unique($a));
?>
判断字符串是否全由数字组成
<?
$str='1234425';
if(eregi('^[0-9]*$',$str)){
echo '此字串由全数字组成';
}
?>