Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

phpµÄsimpletest¿ò¼Ü¶ÔuchomeÏîÄ¿½øÐнӿڲâÊԽű¾

<?php
require_once ('unit_tester.php');
require_once ('reporter.php');
require_once ('../config.php');
require_once ('../source\modules\user\user_api.func.php');
require_once ('../source/base_model.class.php');
Class registertest extends UnitTestCase{
public function testAssertEqual(){
$base = new base_model();
$_ENV['base'] = $base;
$base->db->query("delete from uc_members where uid is not null");
$base->db->query("alter table uc_members AUTO_INCREMENT=1");
//testcase1
$this->assertEqual(1,$num=api_user_register("123","12","1234@12.cn"),"register success so ,expect result 1,reality:".$num.",line 15");
//testcase1
//testcase2
$this->assertEqual(-1,$num=api_user_register("12","321","1234@12.cn"),"register failed because of length of username fewer than 3 ,expect result -1,reality:".$num.",line 18");
//testcase2
//testcase3
$base->db->query("delete from uc_badwords");
$base->db->query("insert into uc_badwords(find,findpattern) values('²Ý','/²Ý/is')");
$this->assertEqual(-2,$num=api_user_register("3²Ýf","232s","sdasx@fs.com"),"api_user_register(3²Ýf,232s,sdasx@fs.com) ,register failed because of content bad words in it ,expect result -2,reality:".$num.",line 23");
//testcase3
//testcase4
$this->assertEqual(-1,$num=api_user_register("#@","dsx","sdxzc@fs.com"),"register failed because of unexpect symbols in username ,expect result -1,reality:".$num.",line 26");
//testcase4
//testcase5
$this->assertEqual(-1,$num=api_user_register("   Guest","098","sd78a@dscx.net"),"register failed becase of username content unexpected words as Guest ,expect result -1,reality:".$num.",line 28");
//testcase5
//testcase6
$this->assertEqual(-1,$num=api_user_register("sdads78778z23ws1","9890s","sd xa@83.com"),"register failed because of length of username more than 15 ,expect result -1,reality:".$num.",line 31");
//testcase6
//testcase7
$num=$base->db->result_first("select max(uid) from uc_members");


Ïà¹ØÎĵµ£º

phpÖе¥ÒýºÅºÍË«ÒýºÅÇø±ð

1 PHPÖе¥ÒýºÅÓëË«ÒýºÅµÄÇø±ð  
¡¡¡¡ÔÚPHPÖУ¬Í¨³£Ò»¸ö×Ö·û´®±»¶¨ÒåÔÚÒ»¶ÔÒýºÅÖУ¬È磺
'I am a string in single quotes'
"I am a string in double quotes"
¡¡¡¡PHPÓï·¨·ÖÎöÆ÷ÊÇÓóɶԵÄÒýºÅÀ´ÅжÏÒ»¸ö×Ö·û´®µÄ¡£Òò´Ë£¬ËùÓÐ×Ö·û´®±ØÐëʹÓÃͬһÖÖµ¥»òÕßË«
ÒýºÅÀ´¶¨Ò忪ʼºÍ½áÊø¡£ÀýÈ磬ÏÂÃæµÄ×Ö´®¶¨ÒåÊ ......

php±í¸ñ(test)

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <style type = "text/css">
        &nbs ......

[PHP]PearµÄʹÓÃ

1. PEARµÄ°²×°, ÕâÀï½éÉÜÀûÓÃPHP5×Ô´øµÄBATÎļþ°²×°£¬ÐèÒªÄÜÉÏÍø¡£
   a. ÔÚPHP5Ŀ¼ÏÂÕÒµ½go-pear.bat£¬Ë«»÷°²×°(±£Ö¤ÄÜÉÏÍø, ÒÔ±ãÏÂÔØ)£¬BAT×Ô¶¯´ÓÍøÉÏÏÂÔØPEARËùÐèµÄ¶«Î÷£»
   b. °´ÕÕÌáʾÊäÈëһЩÉèÖÃÐÅÏ¢£¬Ö÷ÒªÊÇÒª°Ñ¾ÖÓòÍøµÄÍø¹Ø¼ÓÉÏ£¬Èçhttp://192.168.0.1:80/ , pearÒªÓÃÕâ¸öµØÖ··ÃÎÊInterne ......

php ¶ÔÎļþ²Ù×÷

PHP´´½¨Îļþ£¨¼Ð£©ÒÔ¼°Ä¿Â¼²Ù×÷
 Ò»¡¢Ä¿Â¼²Ù×÷
   
      Ê×ÏÈÊÇ´ÓĿ¼¶ÁÈ¡µÄº¯Êý,opendir(),readdir(),closedir(),ʹÓõÄʱºòÊÇÏÈ´ò¿ªÎļþ¾ä±ú,¶øºóµü´úÁгö:
<?php
$base_dir="filelist/";
$fso=opendir($base_dir);
echo  $base_dir."<hr/>";
whil ......

PHPÉú³ÉËæ»ú×Ö·û´®µÄ·½·¨

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", ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ