安装httpd文档格式.docx
《安装httpd文档格式.docx》由会员分享,可在线阅读,更多相关《安装httpd文档格式.docx(15页珍藏版)》请在冰点文库上搜索。
安装文件中的php_xdebug-2.1.0-5.2-vc6.dll文件到F:
\php\php2\ext文件中
修改F:
\php\php2中的php_ini中的内容:
去掉下面代码前的“;
”
extension=php_gd2.dll
extension=php_mysql.dll
extension=php_mysqli.dll
extension=php_pdo.dll
extension=php_pdo_mysql.dll
如:
打入代码:
zend_extension_ts="
\php\php2\ext\php_xdebug-2.1.0-5.2-vc6.dll"
[Xdebug]
xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=localhost
xdebug.remote_port=9000
安装navicat091_premium_cs.exe
然后先安装jdk-6u10-rc2-bin-b32-windows-i586-p-12_sep_2008.exe,后安装netbeans-6.9.1-ml-php-windows.exe
打开php
单引号不能转意,不能设置变量,
<
?
php
$output='
abc'
;
//单引号快
echo"
$output\tsomething<
/br>
"
//结果abcsomething
echo$output.'
\'
tsomething'
//结果abc'
tsomething
//加数字的时候用(+),字符串连接用(.),且两边都得加空格;
echo3+4;
//结果7;
//echo3.4;
//结果34;
>
当点击页面后刷新出现下面这个页面的话:
那就是用了form的post方法
<
?
问号里的东西是在服务器中解析的,在源文件中是看不到的
在本页显示:
用define定义常量,且不用$定义
$something=”abc“;
define(“somet”,”abc”);
Functionsomefunc()
{
$somethig=”def”;
echo$something;
echosomet;
}
算总价钱
$tires=$_POST["
tires"
];
$oils=$_POST["
oils"
$fire=$_POST["
fire"
define(“tirerice”,500);
define(“oilrice”,7.2);
define(“firerice”,200);
$sum=$tires*tirerice+$oils*oilrice+$fire*firerice;
把订单的记录放入orders记事本中
$logStr=$tires.“条胎\t”.$oils.“升油\t”.$fire.“个火花塞\t\n”;
$path=$_SERVER[‘DOCUMENT_ROOT’].”/myPhp/Lesson1.orders.txt”;
$fP=fopen($path,‘ab’);
flock($fp,LOCK_EX);
fwrite($fp,$logStr,strlen($logStr));
flock($fp,LOCK_UN);
fclose($fp);
可在php中使用perl的heredoc语法,即通过指定字符串结束标记来创建字符串。
$str2=<
end//开始定义
Exampleofstring
spanningmultiplelines
usingheredocsyntax.
end;
//结束定义
Exampleofstringspanningmultiplelinesusingheredocsyntax.
php是弱类型语言,可用以下方式来定义变量
$str=“0”;
错误抑制符:
@$v1=23/0;
//这一行的错误不会被显示出来
执行操作符
$out=`ls/-la`;
echo‘<
pre>
’.$out.’<
/pre>
’;
isset是用来判断一个变量是否已经设置
empty是用来判断一个变量是否为空
如果var是非空或非零的值,则empty()返回FALSE。
换句话说,"
、0、"
0"
、NULL、FALSE、array()、var$var;
以及没有任何属性的对象都将被认为是空的,如果var为空,则返回TRUE。
用unset就什么都删除了,用来直接删除
$out=‘’;
unset($out);
echoisset($out).‘<
br/>
echoempty($out).‘<
用define声明常量的话,始终显示最前面声明的值
j++和++j的区别:
j++是先运算后相加
++j是先加后运算
No.1单双引号的区别
somethingishappened
$str1ishappened
No.2Heredoc
可在php中使用Perl的heredoc语法,即通过指定字符串结束标记来创建字符串。
$str2=<
end
Exampleofstringspanningmultiplelinesusingheredocsyntax.
No.3变量类型
Integer(整数),Float(所有实数)
String(字符串)
Boolean(布尔)
Array(数组)
Object(对象,用来保存类的实例)
php是弱类型语言,可用以下方式定义变量而不会出错:
$var=0;
$var='
Hello'
No.4声明常量
define('
SOMECONST'
100);
常量中需要注意的是,常量一旦被声明,是全局可见的,也就是说可在函数内外使用。
functionv()
{$v="
showvariable"
echo$v;
functionc()
{define("
C"
"
showconst"
);
echoC;
No.5操作符
$j=0;
$k=1;
for($i=0;
$i<
100;
$i++)
$k*=$j++;
$i$j$k分别是多少
No.6三个特殊的操作符
三元操作符:
condition?
valueiftrue:
valueiffalse
@$v1=23/0;
$v2=24/0;
执行操作符:
$out=`ls/-la`;
echo'
'
.$out.'
No.7可变函数
gettype和settype
$out='
123'
echogettype($out).'
settype($out,'
double'
echogettype($out);
isset、unset和empty
echoisset($out).'
br/>
'
echoempty($out).'
变量
empty()
is_null()
isset()
$a="
true
false
$a=null;
$a;
$a=array();
$a=false;
$a=15;
$a=1;
$a=0;
true"
false"
PHP:
foreach(DataRowdrindt.Rows)集合->
单项
C#:
foreach(listItemitminddl.Items)单项->
集合
$db=newPDO("
mysql:
host=localhost;
dbname=myphp"
root"
mysql"
$db->
query("
setnamesUTF8"
让中文显示出来
$query=$db->
select*fromnamelist"
//输出的三种方法:
//1.
//foreach($queryas$row)
//{
//print_r($row);
//}
//2.
while($row=$query->
fetch())
{
print_r($row);
}
//3.
//$aryRs=$hdlRs->
fetchAll();
//print_r($aryRs);
把查出来的数据放到表中
table>
<
phpforeach($queryas$row){?
tr>
td>
echo$row[1];
/td>
echo$row[2];
/tr>
php}?
/table>
SQL正序排列和倒序排列
orderbyasc;
正序
orderbydesc;
倒序