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");
Ïà¹ØÎĵµ£º
ÓÃAjaxʵÏÖTabЧ¹ûµÄ
ÏÈ´´½¨
ajax.php£¬ÔÚÆäÖÐÊäÈëÈçÏ´úÂ룺
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Sample 2_1</title>
<me ......
×î½üÒ»ÄêÒÔÀ´£¬Õ¾³¤½çÓÐÒ»¸öÇ÷ÊÆ: ºÜ¶àÕ¾³¤×ªÐÍ×öµç×ÓÉÌÎñ£¬»òÀûÓÃÏÖÓеÄÍøÕ¾×ÊÔ´ÕûºÏµç×ÓÉÌÎñ¡£Ò»·½ÃæÓÉÓÚÍøÕ¾Ô½À´Ô½ÄÑ×ö£¬¶øÍ¬Ê±ÔÚ¾¼Ã´ó»·¾³µÄÓ°ÏìÏ£¬ÍøÉϹºÎïȴԽΪԽ³ÔÏ㡣ת×öÍøÉÌ»òÊǽáºÏÍøÂ繺ÎïÊǸö²»´íµÄÖ÷Òâ¡£
Òª×öµç×ÓÉÌÎñ£¬Äã¿ÉÒÔÑ¡ÔñÔÚÌÔ±¦£¬ÅÄÅÄ£¬Ebay»òÊÇ×îеİٶÈÓа¡£¬¶øÈç¹ûÒª×Ô¼º´î½¨Æ½Ì¨£¬µ±È»Ê× ......
1 PHPÖе¥ÒýºÅÓëË«ÒýºÅµÄÇø±ð
¡¡¡¡ÔÚPHPÖУ¬Í¨³£Ò»¸ö×Ö·û´®±»¶¨ÒåÔÚÒ»¶ÔÒýºÅÖУ¬È磺
'I am a string in single quotes'
"I am a string in double quotes"
¡¡¡¡PHPÓï·¨·ÖÎöÆ÷ÊÇÓóɶԵÄÒýºÅÀ´ÅжÏÒ»¸ö×Ö·û´®µÄ¡£Òò´Ë£¬ËùÓÐ×Ö·û´®±ØÐëʹÓÃͬһÖÖµ¥»òÕßË«
ÒýºÅÀ´¶¨Ò忪ʼºÍ½áÊø¡£ÀýÈ磬ÏÂÃæµÄ×Ö´®¶¨ÒåÊ ......
1. °²×°php5.1ÒÔÉϵİ汾,ÓÐÖ§³Öpdo!ΪÁËʹÄãµÄ»·¾³ÄÜÌṩ¶ÔpdoµÄÖ§³Ö!ÔÚphp.iniÎļþ¼ÓÈëÒÔÏÂ:
extension=php_pdo.dll
extension=php_pdo_mysql.dll
extension=php_pdo_mssql.dll(Ö§³ÖmssqlÊý¾Ý¿â)
2. ÒÔÏÂΪPHÖÐPDOµÄ¾ßÌåʹÓÃ
<?php
$dsn = 'mysql:dbname=MyDbName;host=localhost';
$user = 'root';
......
<?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 = ......