php基本知识
1.php数组基础:
<?php
$ary2 = "zqhung_hongzequan_zqhong";
$arr3 =explode("_",$ary2);//拆分字符串
echo $arr3[1];//打印出来的结果是hongzequan
$ary1 = array("aa","bb");
$ary1[0]="zqhung";//修改数组中的值
echo $ary1[0],"<br>";//打印出来的结果是zqhung
$ary3 = array("id"=>55);
$aa = is_array($ary1);//判断变量是否为数组
echo $aa,"<br>";
echo count($ary1),"<br>";//判断数组中元素的个数
foreach($arr3 as $key=>$value)//遍历数组中的元素
{
echo $value,"<br>";
}
?>
2.连接mysql
<?php
$conn = @ mysql_connect("localhost", "root", "") or die("连接失败");//连接mysql
mysql_select_db("quanquanfly", $conn) or die("连接失败");//连接quanquanfly数据库
$sql = "insert into aa (name,age) value ('1','2')";
mysql_query($sql, $conn);//执行插入操作
/**
* 执行查询并显示操作
*/
$sql1 = "select * from aa";
$query = mysql_query($sql1,$conn);
$select = mysql_fetch_array($query);
while ($select = mysql_fetch_array($query)) {
echo $select[age], "<br><hr>";
}
echo mysql_num_rows($query);//表中的条目数
mysql_close($conn);//关闭连接
?>
相关文档:
一、字符串基础函数
ltrim: 去除连续空白。
trim: 截去字符串首尾的空格。
Chop: 函数从字符串的末端开始删除空白字符或其他预定义字符。(rtrim别名)
<?php
$str = "Hello World!\n\n";
echo $str;
echo chop($str);
?>
输出:
Hello World! Hello World!
htmlspecialchars(string,quotestyle,characte ......
1.mysql
在如下页面下载mysql的for linux rpm包
http://www.mysql.com/downloads/down...3.52-1.i386.rpm ;
http://www.mysql.com/downloads/down...3.52-1.i386.rpm ;
存至/home/tmp目录
命令列表:
cd /home/tmp
rpm -ivh MySQL-3.23.52-1.i386.rpm #安装mysql serv ......
Apache 2 and PHP Installation
The following notes are how I got Apache 2 and PHP 5 (or PHP 4) working together on Linux. These instructions also apply, mostly, for any UNIX-like system, especially other Linux distributions. If you have a recent Linux distribution (say since 2002), you already hav ......
$thunder = ("Thunder://QUFodHRwOi8vNjAuMTkxLjYwLjEwODo4MDgwL3hweGlhemFpL0RlZXBpbl9HaG9zdF9YUF9WMTguMC5pc29aWg==");
//解密它
$thunder = trim($thunder,'Thunder://');
$c_thunder = base64_decode($thunder);
$c_thunder = ltrim(rtrim($c_thunder,'ZZ'),'AA');
//out [url]http://60.191.60.108:8080/xpxi ......
每个PHP程序员都知道PHP有强大的正则表达式功能,为了以后的工作方便,我从网上整理了关于正则表达式的资料,方便以后工作时的进行资料查阅。
正则表达式(regular expression)描述了一种字符串匹配的模式,可以用来检查一个串是否含有某种子串、将匹配的子串做替换或者从某个串中取出符合某个条件的子串等。 ......