PHP

[email protected]


การสร้างคลาส และใช้งาน ด้วย PHP

<?php
// classa.inc:

class A {
 var $one = 1;

 function show_one() {
  echo $this->one;
 }
}

// page1.php:

include("classa.inc");

$a = new A;
$s = serialize($a);
// store $s somewhere where page2.php can find it.
$fp = fopen("store", "w");
fwrite($fp, $s);
fclose($fp);

// page2.php:

// this is needed for the unserialize to work properly.
include("classa.inc");

$s = implode("", @file("store"));
$a = unserialize($s);

// now use the function show_one() of the $a object.
$a->show_one();
?>
 สร้างเมือวันที่ :03-07-2548  ที่มา.www.php.net 

เกี่ยวกับเรา | Site Map | Privacy Policy | ติดต่อเรา | ©2005 Company Name

Hosted by www.Geocities.ws

1