易截截图软件、单文件、免安装、纯绿色、仅160KB

php 缩略图函数

function getThumbs($filename,$savepath,$d_w,$d_h,$b,$img_name)
{
    if($b)
    {
        $photourl = $savepath."/".$img_name;
    }else
    {
        $photourl = $savepath;
    }
    $width = $d_w;
    $height= $d_h;
    list($width_orig, $height_orig,$image_type) = getimagesize($filename);
    $extends = $image_type == 1 ? "gif" : "jpg";
    $x = 0;$y = 0;
    if($d_w==$d_h)
    {
        if ($width && ($width_orig < $height_orig))
        {
            $height = ($width / $width_orig) * $height_orig;
            $y      = round(($height-$d_h)/2);
        } else
        {
            $width  = ($height / $height_orig) * $width_orig;
            $x      = round(($width-$d_w)/2);
        }
    }else
    {
        if($d_h>$d_w)
        {
            $width  = ($height / $height_orig) * $width_orig;
            //                $x      = round(($width-$d_w)/2);
        }else
        {
            $height = ($wi


相关文档:

有没有办法在php中实现多线程呢?

(转)问题:
有没有办法在php中实现多线程呢?
假设你正在写一个基于多台服务器的php应用,理想的情况时同时向多台服务器发送请求,而不是一台接一台。
可以实现吗?
回答:
当有人想要实现并发功能时,他们通常会想到用fork或者spawn threads,但是当他们发现php不支持多线程的时候,大概会转换思路去用一些不够好的 ......

php框架codeigniter数据库操作整理

Tag:  
-
1.
$query = $this->db->query('SELECT name, title, email from my_table');
foreach ($query->result() as $row)
{
echo $row->title;
echo $row->name;
echo $row->email;
}
2.
foreach ($query->result_array() as $row)
{
echo $row['title'];
echo $row['name'];
ech ......

javascript 转换为UNIX时间戳,PHP可用

//转换为UNIX时间戳
function strtotimestamp(datestr)
{
    var new_str = datestr.replace(/:/g,"-");
    new_str = new_str.replace(/ /g,"-");
    var arr = new_str.split("-");
    var datum = new Date(Date. ......

[转]asp、php、asp.net、jsp介绍及优缺点比较


     现在主流的网站开发语言无外乎asp、php、asp.net、jsp等。
     
     网页从开始简单的hmtl到复杂的服务语言,走过了10多个年头,各种技术层出不穷,单个的主流技术也在不断翻新的版本,现在分析下各种语言的区别、优势、劣势、开发注意事项!
   ......

php 调用 sudo 不执行问题

代码
//第一种方式
exec($cmd,$str,$result);
echo "result = $result <br/>";
if ($result != 0) {
    echo "failed";
}
print_r($str);
#没有输出结果
//第二种方式
$output = shell_exec("/usr/bin/sudo /usr/bin/whoami 2>&1);
echo "output = ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号