首页 > substr

二款php数据库备份类程序代码

下面看下使用方法:

<?php
error_reporting(0);//消灭万恶的php报警提示
//设定邮箱
$options = array('email' => array('email1', 'email2'),
'folder' => './backup/',
'mysql' => array('localhost', 'user', 'password', 'db'));
 
$b = new Backup($options);
 
  // 提交备份命令
  if(isset($_POST['backup']))
  {
   // 开始备份
   $b->backupDB();
  }
  // 显示备份表
  $b->outputForm();
?>

阅读全文

PHP生成随机字符串程序代码

利用for循环把我们定义好的字符遍历即可


<?php
/* Generate Password
* Length : 8
*/
$str = “0123456789abcdefghijklmnopqrstuvwxyz”;   //   输出字符集
$n = 8;   //   输出串长度
$len = strlen($str)-1;
for($i=0 ; $i<$n; $i++){
$s .=  $str[rand(0,$len)];
}
echo $s . “<br/>”;
?>

阅读全文

PHP 利用curl_init发起http请求模仿登录

备注:使用curl_init函数,必须要打开这个php扩展。

1.打开php.ini,开启extension=php_curl.dll
2.检查php.ini的extension_dir值是哪个目录,检查有无php_curl.dll,没有的请下载php_curl.dll,再把php目录中的libeay32.dll,ssleay32.dll拷到c:/windows/system32里面。

阅读全文