三种方法.
1.
三种方法.
1.
发送HTTP请求:
<?
//设置PHPExcel类库的include path
set_include_path('.'. PATH_SEPARATOR .
'D:ZealPHP_LIBS' . PATH_SEPARATOR .
get_include_path());
php代码
<?php
header('Content-type: text/json');
功能简单,直接上代码。
<a href='shortcuts.php'>火星时代IT开发</a>
/**
* 获取系统信息
*
* @return array
*/
function getSystemInfo()
{
$systemInfo = array();
// 系统
$systemInfo['os'] = PHP_OS;
// PHP版本
$systemInfo['phpversion'] = PHP_VERSION;
// Apache版本
$systemInfo['apacheversion'] = apache_get_version();
// ZEND版本
$systemInfo['zendversion'] = zend_version();
// GD相关
if (function_exists('gd_info'))
{
$gdInfo = gd_info();
$systemInfo['gdsupport'] = true;
$systemInfo['gdversion'] = $gdInfo['GD Version'];
}
else
{
$systemInfo['gdsupport'] = false;
$systemInfo['gdversion'] = '';
}
// 安全模式
$systemInfo['safemode'] = ini_get('safe_mode');
// 注册全局变量
$systemInfo['registerglobals'] = ini_get('register_globals');
// 开启魔术引用
$systemInfo['magicquotes'] = (function_exists("get_magic_quotes_gpc") && get_magic_quotes_gpc());
// 最大上传文件大小
$systemInfo['maxuploadfile'] = ini_get('upload_max_filesize');
// 脚本运行占用最大内存
$systemInfo['memorylimit'] = get_cfg_var("memory_limit") ? get_cfg_var("memory_limit") : '-';
return $systemInfo;
}
similar_text — 计算两个字符串的相似度
int similar_text ( string $first , string $second [, float &$percent ] )
$first 必需。规定要比较的第一个字符串。
$second 必需。规定要比较的第二个字符串。
$percent 可选。规定供存储百分比相似度的变量名。
1.Com链接,ADODB.Connection
$conn = new Com(“ADODB.Connection”); //实例化一个Connection对象
$connstr = “provider=sqloledb;datasource=.;uid=sa;pwd=123456;database=jnold;”;
$conn->Open($connstr);
$rs = new Com(“ADODB.Recordset”); //实例化一个Recordcount对象
/**
* 创建父节点树形数组
* 参数
* $ar 数组,邻接列表方式组织的数据
* $id 数组中作为主键的下标或关联键名
* $pid 数组中作为父键的下标或关联键名
* 返回 多维数组
**/
function find_parent($ar, $id='id', $pid='pid') {
foreach($ar as $v) $t[$v[$id]] = $v;
foreach ($t as $k => $item){
if( $item[$pid] ){
if( ! isset($t[$item[$pid]]['parent'][$item[$pid]]) )
$t[$item[$id]]['parent'][$item[$pid]] =& $t[$item[$pid]];
class db {
private $mysqli; //数据库连接
private $options; //SQL选项
private $tableName; //表名
public function __construct($tabName) {
$this->tableName = $tabName;
$this->db ();
}
private function db() {
$this->mysqli = new mysqli ( 'localhost', 'root', '', 'hdcms' );
$this->mysqli->query("SET NAMES GBK");
}
public function fields($fildsArr) {
if (empty ( $fildsArr )) {
$this->options ['fields'] = ''
}
if (is_array ( $fildsArr )) {
$this->options ['fields'] = implode ( ',', $fildsArr );
} else {
$this->options ['fields'] = $fildsArr;
}
return $this;
}
public function order($str) {
$this->options ['order'] = "ORDER BY " . $str;
return $this;
}
public function select() {
$sql = "SELECT {$this->options['fields']} FROM {$this->tableName} {$this->options['order']}";
return $this->query ( $sql );
}
private function query($sql) {
$result = $this->mysqli
->query ( $sql );
$rows = array ();
while ( $row = $result->fetch_assoc () ) {
$rows [] = $row;
}
return $rows;
}
private function close() {
$this->mysqli
->close ();
}
function __destruct() {
$this->close ();
}
}
$chanel = new db ( "hdw_channel" );
$chanelInfo = $chanel->fields ( 'id,cname,cpath' )
->select ();
echo "<pre>";
print_r ( $chanelInfo );
1. 判断Email:
域名由各国文字的特定字符集、英文字母、数字及“-”(即连字符或减号)任意组合而成, 但开头及结尾均不能含有“-”,“-”不能连续出现 。 域名中字母不分大小写。域名最长可达60个字节(包括后缀.com、.net、.org等)。
/^[a-z]([a-z0-9]*[-_]?[a-z0-9]+)*@([a-z0-9]*[-_]?[a-z0-9]+)+[.][a-z]{2,3}([.][a-z]{2})?$/i;
/内容/i 构成一个不区分大小写的正则表达式;