PHP¼ÆËãÒ³ÃæÖ´ÐÐʱ¼ä
run_time.php Code:
<?php
class runtime
{
var $StartTime = 0;
var $StopTime = 0;
function get_microtime()
{
list($usec, $sec) = explode(' ', microtime());
return ((float)$usec + (float)$sec);
}
function start()
{
$this->StartTime = $this->get_microtime();
}
function stop()
{
$this->StopTime = $this->get_microtime();
}
function spent()
{
return round(($this->StopTime - $this->StartTime) * 1000, 1);
}
}
?>
return_time_test.php Code:
<?php
include ('run_time.php');
$runtime = new runtime;
$runtime->start();
$a = 0;
for ($i=0;$i<rim(1000000);$i++){
$a += $i;
}
$runtime->stop();
echo "Ò³ÃæÖ´ÐÐʱ¼ä£º".$runtime->spent()."ºÁÃë!";
?>
Ïà¹ØÎĵµ£º
Ç¿´ó¶øÇÒÃâ·ÑµÄ zend studio Ê×µ±Æä³å£¬¿Éϧ±¾ÈË»úÆ÷ÅäÖò»¸ß£¬ÔËÐÐÆðÀ´Ê®·Ö³ÔÁ¦£¬ÓÃûÁ½´ÎÌ«ÊÜ×ï¾Í·ÅÆúÁË¡£
PHPEdit£¬¶ÌС¾«º·£¬¿ÉÏÞʱÊÔÓ㬸оõÒ»°ã¡£
PHPDesigner ÕýÔÚÓ㬻¹ÊÇ¿ÉÒÔÒ»ÊÔ£¬ÍøÉϵÄ×¢²á»ú³öµÄÒ²Ï൱¼°Ê±¡£ 0.0
´¿Îı¾±à¼ Editplus »¹Êdz£±¸¹¤¾ß¡£ ......
1. $_GET
£º
http://localhost/a.php?a=ok
<?
echo
$_GET['a']; //ÏÔʾ"ok"
?>
2. $_SERVER['QUERY_STRING']
http://localhost/a.php?a=1&b=2&c=3
......
1 PHPÖе¥ÒýºÅÓëË«ÒýºÅµÄÇø±ð
¡¡¡¡ÔÚPHPÖУ¬Í¨³£Ò»¸ö×Ö·û´®±»¶¨ÒåÔÚÒ»¶ÔÒýºÅÖУ¬È磺
'I am a string in single quotes'
"I am a string in double quotes"
¡¡¡¡PHPÓï·¨·ÖÎöÆ÷ÊÇÓóɶԵÄÒýºÅÀ´ÅжÏÒ»¸ö×Ö·û´®µÄ¡£Òò´Ë£¬ËùÓÐ×Ö·û´®±ØÐëʹÓÃͬһÖÖµ¥»òÕßË«
ÒýºÅÀ´¶¨Ò忪ʼºÍ½áÊø¡£ÀýÈ磬ÏÂÃæµÄ×Ö´®¶¨ÒåÊ ......
<?php
define('SMARTY_TMP_DIR','C:/php5/Smarty-2.6.13/');
define('SMARTY_DIR','C:/php5/Smarty-2.6.13/libs/'); //SMARTY_DIR ->smarty keyword,must be defined as libs dectory
require_once(SMARTY_DIR.'Smarty.class.php');
//½¨Á¢Ò»¸ösmarty¶ÔÏó
$smarty = new Smarty;
$smarty->template_dir = ......
Code:
<?php
function genRandomString($len)
{
$chars = array(
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
"l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v",
"w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G",
"H", "I", "J", "K", "L", "M", "N", "O", ......