Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB
ÈÈÃűêÇ©£º c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 ×îÐÂÎÄÕ : php

php ×Ö·û´®²Ù×÷º¯ÊýÏê½â

×Ö·û´®µÄ²Ù×÷ÔÚPHP±à³ÌÖÐÕ¼ÓÐÖØÒªµÄµØ룬¼¸ºõËùÓÐPHP½Å±¾µÄÊäÈëºÍÊä³ö¶¼Óõ½×Ö·û´®¡£ÓÈÆäÔÚPHPÏîÄ¿¿ª·¢¹ý³ÌÖУ¬ÎªÁËʵÏÖijÏÄÜ£¬¾©³ÇÐèÒª¶ÔijЩ×Ö·û´®½øÐÐÌØÊâ´¦Àí£¬Èç»ñÈ¡×Ö·û´®µÄ³¤¶È¡¢½ØÈ¡×Ö·û´®¡¢Ìæ»»×Ö·û´®µÈ¡£ËùÒÔÕâÒ²ÊÇÎÒÃǽñÌì¿Î³ÌµÄÖ÷ÒªÄÚÈÝ£¬Ï£ÍûѧԱ¿ÉÒÔÈÏÕæѧϰ£¬ÇÚ¼ÓÁ·Ï°¡£
8.3.1 È¥³ý×Ö·û´®Ê×λ¿Õ¸ñºÍÌØÊâ×Ö·û
1.  trim()º¯Êý£º trim()º¯ÊýÓÃÓÚÈ¥³ý×Ö·û´®×óÓÒÁ½±ßµÄ¿Õ¸ñ¼°\n,\r,\tµÈ£¬Óï·¨£º
String trim(string str[,string charlist]);
    2£® ltrim()º¯Êý£º´Ëº¯ÊýÓÃÓÚÈ¥³ý×Ö·û´®×ó±ßµÄ¿Õ¸ñ»òÕßÖ¸¶¨×Ö·û´®£¬Ó÷¨Óëtrim()Ò»Ñù£¬ÕâÀï²»ÔÙ¶à×ö½éÉÜ¡£Ïà¶ÔÓ¦µÄ£¬»¹ÓÐÒ»¸örtrim()º¯Êý£¬ÓÃÀ´È¥³ý×Ö·û´®ÓұߵĿոñ»òÖ¸¶¨×Ö·û´®¡£
8.3.2 תÒå¡¢»¹Ô­×Ö·û´®Êý¾Ý
1. ÊÖ¶¯×ªÒå¡¢»¹Ô­×Ö·û´®Êý¾Ý
תÒå·û£º\
ʹÓ÷½·¨£º½«´ËתÒå·û·ÅÔÚÒªÏÔʾµÄÌØÊâ·ûºÅ֮ǰ¼´¿É£¬ÈçÒªÔÚ×Ö·û´®ÖÐÏÔʾ’£¬¾ÍÐèÒªÓÃתÒå·û\’£¬ÕâÑù£¬½ô¸úÔÚ\ºóÃæµÄµÚÒ»¸ö×Ö·û¾Í±äµÃûÓÐÒâÒå»îÓÐÌØÊâÒâÒ壬ÈçÏÂʵÀý£º
<?php
    echo ‘select * from tb_book where bookname = \’PHP³õ¼¶½Ì²Ä\’’;
?>
Êä³ö½á¹ûΪ£ºsele ......

php ÈÕÆÚºÍʱ¼ä

PHPÌṩÁË´óÁ¿µÄÄÚÖú¯Êý£¬Ê¹¿ª·¢ÈËÔ±ÔÚʱ¼äµÄ´¦ÀíÉÏÓÎÈÐÓÐÓ࣬´ó´óÌá¸ßÁ˹¤×÷ЧÂÊ¡£ÎÒÃǽñÌì¾ÍΪѧԱ½éÉÜһЩ³£¼ûµÄPHPÈÕÆÚºÍʱ¼äº¯ÊýÒÔ¼°ÈÕÆÚºÍʱ¼äµÄ´¦Àí¡£
9.1 ³£ÓõÄÈÕÆÚºÍʱ¼ä´¦Àíº¯Êý
±í9-1£º³£ÓõÄÈÕÆÚºÍʱ¼ä´¦Àíº¯Êý
º¯ Êý
˵  Ã÷
checkdate
Ñé֤ʱ¼äº¯Êý£¬ÅжÏʱ¼äÊÇ·ñÓÐЧ£¬ÓÐЧ·µ»Øtrue£¬·ñÔò·µ»Øfalse
date_default_timezone_get
È¡µÃ½Å±¾ÈÕÆÚʱ¼äº¯ÊýËùʹÓõÄĬÈÏʱÇø
date_default_timezone_set
É趨ÈÕÆÚʱ¼äº¯ÊýµÄĬÈÏʱÇø
date
¸ñʽ»¯Ò»¸ö±¾µØʱ¼ä/ÈÕÆÚ
getdate
»ñÈ¡ÈÕÆÚ/ʱ¼äÐÅÏ¢
gettimeofday
»ñÈ¡µ±Ç°Ê±¼ä
localtime
»ñÈ¡±¾µØʱ¼ä
microtime
·µ»Øµ±Ç°Ê±¼ä´ÁºÍ΢ÃëÊý
mktime
È¡µÃÒ»¸öUNIXʱ¼ä´Á
strtotime
½«ÈκÎÓ¢ÎÄÎı¾µÄÈÕÆÚʱ¼äÃèÊö½âÎöΪUNIXʱ¼ä´Á
time
·µ»Øµ±Ç°µÄUNIXʱ¼ä´Á
9.2 ´¦ÀíÈÕÆÚºÍʱ¼ä
9.2.1 »ñÈ¡µ±Ç°ÈÕÆÚºÍʱ¼ä£ºdate()º¯Êý£¬Ó÷¨£º
date(string format,int timestamp)
¸Ãº¯Êý½«·µ»Ø²ÎÊýtimestamp°´ÕÕÖ¸¶¨¸ñʽ¶ø²úÉúµÄ×Ö·û´®¡£ÆäÖвÎÊýtimestampÊÇ¿ÉÑ¡µÄ£¬Èç¹ûÊ¡ÂÔ£¬ÔòʹÓõ±Ç°Ê±¼ä¡£format²ÎÊý¿ÉÒÔʹ¿ª·¢ÈËÔ±°´ÆäÖ¸¶¨µÄ¸ñʽÊä³öʱ¼äÈÕÆÚ¡£
date_default_timezone_set(PRC);  //ÉèÖñ±¾©Ê±¼ä. ......

PHP µÄ×Ö·û´®±í´ïÈýÖÖ·½Ê½


µ¥ÒýºÅ
      $str = 'ÎÒÊÇһͷ´ó»ÒÀÇ';
Ë«ÒýºÅ
      $str2 = "ÄãÒ²ÊÇһͷ´ó»ÒÀÇ";
¶¨½ç·û
      $str3 = <<< DDD
          ¶¼ÊÇ´ó»ÒÀÇ£¬
          ÎÒÃÇÒ»ÆðÑ°ÕÒС·ÊÑò~
         DDD;
»¨À¨ºÅ½ç¶¨±äÁ¿Ãû
    echo "${meter}Ã×" ......

[PHP] еÄÀï³Ì±® Hush Framework

²»Öª²»¾õ£¬5Ô¹ýÁË´ó°ëÁË£¬Ïë±£³Öÿ¸öÔÂÖÁÉÙ¸ø Blog Ìí¼ÓһЩÐÂÏʵÄÎÄÕ£¬Ò²Ëæ±ã¸ø×Ô¼ºµÄ career ¹ì¼£×öÒ»¸ö¼Ç¼£¬ÓÚÊÇÌá±Ê£¬ºÇºÇ~ ½ñÌìÒª½éÉÜÒ»ÏÂʯͷ×îеÄ×÷Æ· Hush Framework£¬Õâ¸ö¿ò¼ÜÊÇÎÒÕâÁ½¸öÔµÄÐÄѪ֮×÷£¬±¾ÈË»¹ÊDZȽÏÂúÒâµÄ£¬ÒÔÏ»á¸ø´ó¼Ò½éÉÜһЩÕâ¸ö¶«¶«µÄÁÁµã¡£Õâ¸ö×÷Æ·µÄ±¾ÒâÊÇΪ¹«Ë¾ÈÕºóµÄÓ¦Óÿª·¢Ìṩһ¸ö±ãÀûµÄ¿ª·¢Ä£°å£¬×ö×Å×öןÜ×ÔÈ»µÄÏ뻹ÊÇ×ö³ÉһЩÍêÕûµÄ¿ò¼Ü±È½ÏÓÐÒâ˼£¬ÓÚÊÇ Hush Framework £¨ÒÔϼò³ÆHF£© Ó¦Ô˶øÉú¡£
·Ï»°²»¶à˵£¬¸Ï¿ìÀ´¿´¿´ HF Ö÷ÒªµÄÁÁµã°É£¨¼ûÒÔϽØͼ´øÎåÐǵÄÐУ©£º
Õâ¸ö¾ÍÊÇǰ̨µÄ²âÊÔ½çÃæ £¨ÁíÍ⻹Óкǫ́½çÃ棩£¬¿ÉÒÔ¿´µ½ÉÏÃæºÜÇå³þµÄµã³ö HF µÄ¼¸¸öÖ÷ÒªÓŵ㣬ÏÂÃæ¾ßÌå½éÉÜһϣº
1¡¢¹ØÓÚ MVC£º
ʵ¼ÊÉÏ HF »ù±¾Éϸ´ÖÆÁË ZF µÄ MVC ½á¹¹£¬Module ʹÓõÄÊÇ»ùÓÚ Zend_Db µÄ Hush_Db À࣬Hush_Db ÀàʹÓõÄÊÇ Zend_Db »ù±¾µÄ Adaptor£¬È»ºóÔÚÉÏÃæÌí¼ÓÁËһЩÓÅ»¯µÄ·½·¨£¬±ÈÈç¶àÐвåÈëµÈ£¬È»ºó°Ñ Hush_Debug ÀàǶÈëÆäÖУ¬ÈÃÓû§¿ÉÒÔºÜÇáÒ×µÄʹÓà Debug ¿ØÖÆ̨¹Û²âÓ¦ÓõÄËùÓÐ SQL¡£¶øÔÚ View ·½Ã棬HF ʹÓõÄÊÇ Smarty Ä£°å£¬Õâ¸öÀíÓɾͲ»¶à˵ÁË°É£¬È»ºóÓÅ»¯ÁË ZF µÄ URL Router Á÷³Ì»úÖÆ£¬Ìí¼ÓÁË°üº¬Ä£ºýÆ¥Å书ÄÜµÄ mapping Îļ ......

PHP²åÈëÊý¾Ý¿â´úÂ룬±à¼­£¬É¾³ý

²åÈë´úÂë
 <?
$action=$_GET['action'];
switch($action){
//Ìí¼Ó¼Ç¼
case"add";
$mail = trim(htmlspecialchars($_POST["mail"]));
$username = trim(htmlspecialchars($_POST["username"]));
$tel = trim(htmlspecialchars($_POST["tel"]));
$fax = trim(htmlspecialchars($_POST["fax"]));
$company = trim(htmlspecialchars($_POST["company"]));
$address = trim(htmlspecialchars($_POST["address"]));
$sql="insert into crm_company (mail,username,tel,fax,company,address,addtime) values ('$mail','$username','$tel','$fax','$company','$address','$addtime')";
//echo $sql;
mysql_query($sql,$conn);
print "<mce:script type="text/javascript"><!--
location.href='c_companylist.php';
// --></mce:script>";//*/
}?>
±à¼­´úÂë
<?
$action=$_GET['action'];
switch($action){
//Ìí¼Ó¼Ç¼
case"edit";
$uid = trim(htmlspecialchars($_POST["uid"]));
$regtime = trim(htmlspecialchars($_POST["regtime"]));
$deadline = trim(htmlspecialchars($_POST["deadline"]));
$ ......

PHPÓÃÓʼþÈ¡»ØÍü¼ÇÃÜÂ빦ÄÜ£¿

wangjimima.php
<form id="form1" name="form1" method="post" action="mailto.php" onSubmit="return CheckForm()">
<input name="username" type="text" class="in" id="username" size="30" onmouseover="fEvent('mouseover',this)" onfocus="fEvent('focus',this)" onblur="fEvent('blur',this)" onmouseout="fEvent('mouseout',this)" />
<input type="submit" name="Submit" style="background:url(images/bo2.jpg); height:36px; width:113px; border:none; font-size:14px; font-weight:bold; color:#FFFFFF" value=" È·¶¨ÕÒ»Ø " />
</form>
mailto.php
<?php
require_once ('conn.php');
require_once ("mailclass.php");
$username = trim($_POST['username']);
$sql="select username,email,password from member where username='$username'";
$query=mysql_query($sql,$conn);
$num=mysql_num_rows($query);
$userinfo=mysql_fetch_array($query);
if($num<=0){
echo "<mce:script type="text/javascript"><!--
alert('Óû§Ãû²»´æÔÚ£¡');history.back(-1);
// --></mce:script>";
exit;
} ......
×ܼǼÊý:2174; ×ÜÒ³Êý:363; ÿҳ6 Ìõ; Ê×Ò³ ÉÏÒ»Ò³ [12] [13] [14] [15] 16 [17] [18] [19] [20] [21]  ÏÂÒ»Ò³ βҳ
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ