PHP货币换算程序代码

一款实用的PHP货币换算程序代码哦,有需要的朋友可以参考一下。

Copy the above code into a new file and save it as CurrencyConverter.php. Whenever you need to make a conversion just include the class file and call the ‘convert’ function. You will need to enter your own mysql database variables such as the login details. The example below will convert £2.50 GBP into US Dollars ($).

阅读全文

linux 下 php的 iconv()函数

参考phpinfo的信息,iconv模块也已经正确加载。
google一下。原来才知道,原来在linux版本下iconv这个方法还是有点下下问题的。
csdn上的一个网友给出的解决方案为:
一种方法是把iconv换成 mb_convert_encoding
另一种方法是修改iconv 的实现,从glibc 改为libiconv
搞了半天,烦躁!
有朋友碰到的话,也可以这么解决了
按照该网友提供的第一个方法,将iconv方法修改为使用mb_convert_encoding,搞定。。
多谢该网友提供的解决方案。

阅读全文

网址字符串转换成超级链接PHP代码

该函数将 URL 和 E-mail 地址字符串转换为可点击的超级链接。  代码如下 复制代码 function makeClickableLinks($text){$text = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_+.~#?&//=]+)', '<a href="1">1</a>', $text); $text = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_...
阅读全文

PHP 文件与目录删除程序

function RmDirFiles($indir)
 {
    $dh = dir($indir);
    while($filename = $dh->read()) {
      if($filename == "." || $filename == "..")
       continue;
      else if(is_file("$indir/$filename"))
       @unlink("$indir/$filename");
      else
        $this->RmDirFiles("$indir/$filename");
    }
    $dh->close();
    @rmdir($indir);
 }

阅读全文

php cookie登录验证代码

<html>
<head>
<title>Login</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<form name="form1" method="post" action="login.php">
<table width="300" border="0" align="center" cellpadding="2" cellspacing="2">
    <tr>
      <td width="150"><div align="right">用户名:</div></td>
      <td width="150"><input type="text" name="username"></td>
    </tr>
    <tr>
      <td><div align="right">密码:</div></td>
      <td><input type="password" name="passcode"></td>
    </tr>
    <tr>
      <td><div align="right">Cookie保存时间:</div></td>
      <td><select name="cookie" id="cookie">
        <option value="0" selected>浏览器进程</option>
        <option value="1">保存1天</option>
        <option value="2">保存30天</option>
        <option value="3">保存365天</option>
      </select></td>
    </tr>
</table>
<p align="center">
    <input type="submit" name="Submit" value="Submit">
    <input type="reset" name="Reset" value="Reset">
</p>
</form>
</body>
</html>

阅读全文

phpthink中字符串截取代码-支持中文和其它编码

一款不错的支持中文和其它编码截取函数,不会出现乱码情况,有需要的朋友可以参考一下。  代码如下 复制代码 /**+----------------------------------------------------------* 字符串截取,支持中文和其它编码+----------------------------------------------------------* @param string $str 需要转换的字符串* @param string $start 开始位置* @param string $leng...
阅读全文

php无限级分类程序

<?php

$a = array(
  'AAAAAA'  =>  array(
        'aaaaaa' => array(
                 '111111',
                 '222222',
                 '333333'
        ),
        'bbbbbb'  => array(
                  '111111',
                 '222222',
                 '333333'
        ),
        'cccccc'  => array(
                  '111111',
                  '222222',
                  '333333'
        ),                     
  ),
  'BBBBBB'  =>   array(
        'aaaaaa' => array(
                  '111111',
                  '222222',
                  '333333'
        ),
        'bbbbbb'=> array(
                  '111111',
                  '222222',
                  '333333'
        ),
        'cccccc'=> array(
                  '111111',
                  '222222',
                  '333333'
        ),
  ),
  'CCCCCC'  => array(
        'aaaaaa'=> array(
                  '111111',
                  '222222',
                  '333333'
        ),
        'bbbbbb'=> array(
                  '111111',
                  '222222',
                  '333333'
        ),
        'cccccc'         => array(
                  '111111',
                  '222222',
                  '333333'
        ),
  ),
);

阅读全文

经典php批量上传源码

html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
function Check(){
 //alert('dddd');
 for(i=1; i<9; i++){
  if(document.getElementById('v'+i).value == ''){
   document.getElementById('v'+i).name = 'uu';
  }
 }
}

阅读全文