| 추천: 0 , 조회: 79 |
ㅇ php에서 작성한 class의 위치를 /lib/class로 설정하고
class밑의 디렉토리를 java 패키지 같이 설정하여 사용합니다.
ex) /lib/class/common/class.common.object.php
/lib/class/util/class.util.string.php
/lib/class/cont/class.cont.photo.php
ㅇ 생성되는 class는 각자의 성격에 맞는 폴더 아래에서 관리하는거죠!
/********** class.common.object.php ************/
class class_common_object
{
var $m_name = '';
function class_common_object($name)
{
$this->m_name =$name;
register_shutdown_function(array(&$this, '_class_common_object'));
}
function _class_common_object()
{
}
function getName() { return $this->m_name; }
}
/********** func.class.php ************/
function &func_classFactory($classfilename)
{
$classname = func_classInclude($classfilename);
if (!$classname) return;
$code = "return new {$classname}(";
if (func_num_args() > 1)
{
$params = array_slice(func_get_args(),1);
$c = count($params);
for($i=0;$i<$c;++$i)
{
if ($i>0) $code .= ',';
$code .= '$params['.$i.']';
}
}
$code .= ');';
$csObj = eval($code);
return $csObj;
}
function func_classInclude($classfilename)
{
$clsarr = explode(".", $classfilename);
$classname = str_replace(".","_",$classfilename);
for($i=1; $i<count($clsarr)-1; $i++) $filename .= "/" . $clsarr[$i];
$filename =$g_arConfig[CLASS_ROOT] . $filename . "/$classfilename.php";
if (!class_exists($classname))
{
if (file_exists($filename)) include_once($filename);
else
{
echo "\nCould not load library $filename \n";
return null;
}
}
return $classname;
}
/*********** SAMPLE.PHP ***********/
include "func.class.php";
$csObj = func_classFactory("class.common.object", "test");
echo $csObj->getName();
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 2530 |
|
15년 전 | 2605 | |
| 2529 |
|
15년 전 | 1323 | |
| 2528 | 15년 전 | 1020 | ||
| 2527 | 15년 전 | 1496 | ||
| 2526 | 15년 전 | 897 | ||
| 2525 | 15년 전 | 1195 | ||
| 2524 | 15년 전 | 1092 | ||
| 2523 | 15년 전 | 1491 | ||
| 2522 |
NY더지더지
|
15년 전 | 1630 | |
| 2521 | 15년 전 | 899 | ||
| 2520 |
|
15년 전 | 1310 | |
| 2519 |
|
15년 전 | 1101 | |
| 2518 | 15년 전 | 930 | ||
| 2517 |
|
15년 전 | 1003 | |
| 2516 | 15년 전 | 1321 | ||
| 2515 | 15년 전 | 761 | ||
| 2514 | 15년 전 | 943 | ||
| 2513 | 15년 전 | 2599 | ||
| 2512 |
|
15년 전 | 1412 | |
| 2511 |
|
15년 전 | 783 | |
| 2510 |
|
15년 전 | 811 | |
| 2509 | 15년 전 | 1257 | ||
| 2508 | 15년 전 | 1290 | ||
| 2507 | 15년 전 | 1542 | ||
| 2506 | 15년 전 | 1024 | ||
| 2505 | 15년 전 | 1394 | ||
| 2504 |
JMoon
|
15년 전 | 691 | |
| 2503 |
|
15년 전 | 1039 | |
| 2502 | 15년 전 | 1297 | ||
| 2501 | 15년 전 | 2714 | ||
| 2500 | 15년 전 | 1077 | ||
| 2499 | 15년 전 | 1049 | ||
| 2498 | 15년 전 | 951 | ||
| 2497 |
첫만남의감격
|
15년 전 | 827 | |
| 2496 |
|
15년 전 | 837 | |
| 2495 |
|
15년 전 | 3430 | |
| 2494 |
soulfuleyes
|
15년 전 | 2799 | |
| 2493 | 15년 전 | 1983 | ||
| 2492 | 15년 전 | 2431 | ||
| 2491 | 15년 전 | 1519 | ||
| 2490 | 15년 전 | 1062 | ||
| 2489 | 15년 전 | 1059 | ||
| 2488 | 15년 전 | 2337 | ||
| 2487 | 15년 전 | 880 | ||
| 2486 | 15년 전 | 1922 | ||
| 2485 |
못말리는크리스
|
15년 전 | 720 | |
| 2484 |
|
15년 전 | 1875 | |
| 2483 | 15년 전 | 810 | ||
| 2482 | 15년 전 | 2485 | ||
| 2481 | 15년 전 | 726 | ||
| 2480 | 15년 전 | 1161 | ||
| 2479 | 15년 전 | 710 | ||
| 2478 |
|
15년 전 | 2881 | |
| 2477 | 15년 전 | 1256 | ||
| 2476 | 15년 전 | 1287 | ||
| 2475 | 15년 전 | 1299 | ||
| 2474 | 15년 전 | 1360 | ||
| 2473 | 15년 전 | 974 | ||
| 2472 | 15년 전 | 1734 | ||
| 2471 | 15년 전 | 1262 | ||
| 2470 | 15년 전 | 839 | ||
| 2469 | 15년 전 | 2700 | ||
| 2468 | 15년 전 | 1089 | ||
| 2467 | 15년 전 | 1280 | ||
| 2466 | 15년 전 | 1083 | ||
| 2465 | 15년 전 | 1939 | ||
| 2464 | 15년 전 | 1946 | ||
| 2463 | 15년 전 | 1607 | ||
| 2462 | 15년 전 | 961 | ||
| 2461 | 15년 전 | 1202 | ||
| 2460 | 15년 전 | 893 | ||
| 2459 | 15년 전 | 836 | ||
| 2458 | 15년 전 | 1081 | ||
| 2457 | 15년 전 | 2442 | ||
| 2456 | 15년 전 | 2465 | ||
| 2455 | 15년 전 | 1444 | ||
| 2454 | 15년 전 | 993 | ||
| 2453 | 15년 전 | 1144 | ||
| 2452 | 15년 전 | 1153 | ||
| 2451 | 15년 전 | 1015 | ||
| 2450 | 15년 전 | 918 | ||
| 2449 | 15년 전 | 851 | ||
| 2448 | 15년 전 | 1208 | ||
| 2447 | 15년 전 | 1157 | ||
| 2446 | 15년 전 | 905 | ||
| 2445 | 15년 전 | 873 | ||
| 2444 | 15년 전 | 1050 | ||
| 2443 | 15년 전 | 1521 | ||
| 2442 | 15년 전 | 1051 | ||
| 2441 | 15년 전 | 1381 | ||
| 2440 |
|
15년 전 | 1214 | |
| 2439 | 15년 전 | 1889 | ||
| 2438 |
|
15년 전 | 2950 | |
| 2437 |
|
15년 전 | 2284 | |
| 2436 |
|
15년 전 | 883 | |
| 2435 |
|
15년 전 | 1891 | |
| 2434 |
|
15년 전 | 2078 | |
| 2433 |
|
15년 전 | 1380 | |
| 2432 | 15년 전 | 1355 | ||
| 2431 | 15년 전 | 2620 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기