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

PHPÖеÄʵÏÖRegistryģʽ¹ý³ÌÖеÄÁìÎò

<?php
/*
Singleton && Registry Design Pattern Implementation
*/
class Registry {
private $_store = array();
public function getInstance() {
static $instance = array();
if (!$instance) {
$instance[0] = new Registry;
}
return $instance[0];
}
public function &get($key){
if($this->isValid($key)){
return $this->_store[$key];
}
}
public function set($key, $object){
$this->_store[$key] = &$object;
}
public function isValid($key){
return array_key_exists($key,$this->_store);
}
}
?>
Test Case:
<?php
require_once 'simpletest/unit_tester.php';
require_once 'simpletest/reporter.php';
require_once 'Registry.php';
class RegistryTestCase extends UnitTestCase{
function testRegistryIsSingleton(){
$this->assertIsA($reg = Registry::getInstance(), 'Registry');
$this->assertReference($reg, Registry::getInstance());
}
function testEmptyRegistryKeyIsReturnNull(){
$reg = Registry::getInstance();
$this->assertNull($reg->get('key'));
}
function testEmptyRegistryKeyIsInvalid(){
$reg = Registry::getInstance();
$this->assertFalse($reg->get('key'));
}
function testSetRegistryKeyBecomesValid(){
$reg = Registry::getInstance();
$test_value = 'something';
settype($test_value, 'Object');
$reg->set('key', $test_value);
$this->assertTrue($reg->isValid('key'));
}
function testRegistryValueIsReference(){
$reg = Registry::getInstance();
$test_value = 'something';
$reg->set('key', $test_value);


Ïà¹ØÎĵµ£º

php ËõÂÔͼº¯Êý

function getThumbs($filename,$savepath,$d_w,$d_h,$b,$img_name)
{
    if($b)
    {
        $photourl = $savepath."/".$img_name;
    }else
    {
        $photourl = ......

tokyo tyrant ÔÚ php Éϲ»ÄÜ×Ô¶¯·´ÐòÁл¯µÄÎÊÌâ

ǰһÕóÊÔÓà tokyo tyrant Åöµ½Ò»¸öÂé·³£¬
ÔÚphpÉÏÓÃmemcache½Ó¿Ú£¬È¡³öÊý¾ÝµÄʱºò£¬²»»á×Ô¶¯·´ÐòÁл¯¡£±ÈÈçÁËÒ»¸ö array(1,2,3,4,5)£¬³öÀ´¾ÍÊÇ 'a:5:{i:0;i:1;i:1;i:2;i:2;i:3;i:3;i:4;i:4;i:5;}' ÁË¡£
ÓÃ
Wireshark ¸ú×ÙÁËһϣ¬·¢Ïֺͱê×¼memcached·µ»ØµÄÊý¾ÝÀï²îÒ»¸ö×Ö½Ú¡£È¥¿´ÁËÏ memcached
ЭÒ飬·¢ÏÖÕâ¸ö×Ö½ÚÊǸ ......

windowsϺÍlinuxÏÂPHPÖ§³Öoracle

windowsÏÂ:
1.ÏÂÔØÓÃÓÚ Windows µÄ Instant Client Basic ³ÌÐò°ü:http://download.oracle.com/otn/nt/instantclient/111070/instantclient-basic-win32-11.1.0.7.0.zip
2.½âѹËõ
´´½¨Ò»¸ö×ÓĿ¼£¨ÀýÈ磬d:\oci£©£¬È»ºó´ÓѹËõÎļþÖи´ÖÆÒÔÏ¿⣺
oraociei10.dll
orannzsbb10.dll
oci.dll
µ½´ËĿ¼ÏÂ
´ò¿ªPHP.ini ......

¡¾PHP¡¿Ñ¡ÔñÌâÌâ¿âϵͳV1.0

Õâ¸öϵͳÆäʵÊÇÁ·Ï°php»ù±¾Óï·¨ºÍMySQLµÄ»ù±¾²éѯÓï¾ä¡£¸øÒ»ÆðѧϰµÄÅóÓÑ·ÖÏí¡£ ^_^
ÔÚphpÎļþÖУ¬Ë«Ð±¸ÜºóÃæÊÇ×¢ÊÍÓï¾ä£¬ÎÒÓÃÓ¢ÎÄдµÄ×¢ÊÍ¡£
Õû¸öϵͳËù°üº¬µÄ.htmºÍ.phpÎļþÓУº
add_que.htm——Ìí¼ÓÐÂÌâµÄÒ³Ãæ
insert.php——ÏÔʾÌí¼ÓÐÂÌâÐÅÏ¢µÄÒ³Ãæ
questionlist.php——ËùÓÐÎÊÌâÁÐ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ