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

PHP截取固定长度字符串函数

<?php   
  
function toFixLen($str,$len){ //固定长度字符串的截取   
  
    if($len>=strlen($str)||!$len) return $str;   
  
    $len-=3;   
  
    $tempstr1 = substr($str,0,$len); //截取字符串   
  
    $tempstr2 = preg_replace('/([\x81-\xff]+)$/ms','',$tempstr1,1); //去掉结尾的连续汉字字符   
  
    if(!is_int((strlen($tempstr1)-strlen($tempstr2))/2)){ //去掉的字符为奇数?   
  
        $tempstr1 = substr($str,0,$len-1);   
  
    }   
  
    return $tempstr1."…";   
  
}   
  
?>


相关文档:

php soap初识

打开php.ini的soap扩展
server.php
<?php
class math{

/**
* 加法
*
* @param integer $a
* @param integer $b
* @return integer
*
*/
public function add($a, $b){

return $a + $b;
}
}
$server = new SoapServer('http://localhost/math.wsdl',array('soap_version' =& ......

PHP 中巧用数组降低程序的时间复杂度

通常开发人员在写程序的时候,往往是把已经设计好或者构思好的运算逻辑,直接用编程语言翻译出来。程序能顺利编译通过,那是很令人高兴的事情。如果此时程序的运行时间还能接受,就会沉浸在写代码的成就感当中,常常在这个过程中忽略代码的优化。只有当程序运行速度受到影响时,才回过头去考虑优化的事情。
什么是算法的时 ......

php 不用COM 生成excel文件


 
用php生成excel文件
<?
header("Content-type:application/vnd.ms-excel");
header("Content-Disposition:filename=test.xls");
echo "test1/t";
echo "test2/t/n";
echo "test1/t";
echo "test2/t/n";
echo "test1/t";
echo "test2/t/n";
echo "test1/t";
echo "test2/t/n";
echo "test1/t";
e ......

PHP中的MYSQL常用函数总结

PHP中的MYSQL常用函数总结
1、mysql_connect()-建立数据库连接
格式:
    resource mysql_connect([string hostname [:port] [:/path/to/socket] [, string username] [, string password]])
例:
    $conn = @mysql_connect("localhost", "username", "password") or dir( ......

Xjwebs 美国5GB豪华免费PHP主机空间 cPanel面板

今天给大家介绍的事一款来自美国的豪华主机空间,空间类型是PHP的,速度很快,主机配置也很好(4CPU)!
闲话不说了,看免费空间介绍吧:
空间大小:5GB
月流量:10GB
免费MySQL数据库: 无限制
支持脚本:CGI, PHP, FrontPage Extensions, Perl, Python.
支持FTP
支持域名绑定
有免费邮局,是cPanel面板的,支 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号