| 추천: 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();
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 1430 | 18년 전 | 2977 | ||
| 1429 | 18년 전 | 2923 | ||
| 1428 | 18년 전 | 2818 | ||
| 1427 | 18년 전 | 2129 | ||
| 1426 |
|
18년 전 | 2310 | |
| 1425 |
|
18년 전 | 2865 | |
| 1424 |
|
18년 전 | 2957 | |
| 1423 |
frotone
|
18년 전 | 4122 | |
| 1422 | 18년 전 | 6114 | ||
| 1421 | 18년 전 | 2047 | ||
| 1420 | 18년 전 | 2178 | ||
| 1419 | 18년 전 | 1887 | ||
| 1418 | 18년 전 | 1649 | ||
| 1417 | 18년 전 | 2631 | ||
| 1416 | 18년 전 | 1692 | ||
| 1415 | 18년 전 | 1559 | ||
| 1414 | 18년 전 | 4735 | ||
| 1413 | 18년 전 | 1787 | ||
| 1412 | 18년 전 | 1833 | ||
| 1411 | 18년 전 | 1843 | ||
| 1410 | 18년 전 | 1968 | ||
| 1409 | 18년 전 | 3625 | ||
| 1408 | 18년 전 | 1648 | ||
| 1407 | 18년 전 | 1519 | ||
| 1406 | 18년 전 | 1350 | ||
| 1405 | 18년 전 | 1853 | ||
| 1404 | 18년 전 | 1899 | ||
| 1403 |
frotone
|
18년 전 | 3645 | |
| 1402 | 18년 전 | 1974 | ||
| 1401 | 18년 전 | 3106 | ||
| 1400 | 18년 전 | 4727 | ||
| 1399 | 18년 전 | 2858 | ||
| 1398 | 18년 전 | 8043 | ||
| 1397 | 18년 전 | 4055 | ||
| 1396 |
|
18년 전 | 2738 | |
| 1395 | 18년 전 | 1520 | ||
| 1394 | 18년 전 | 2619 | ||
| 1393 | 18년 전 | 5036 | ||
| 1392 | 18년 전 | 5218 | ||
| 1391 |
cncafe
|
18년 전 | 2089 | |
| 1390 |
mixdesign
|
18년 전 | 4348 | |
| 1389 | 18년 전 | 4090 | ||
| 1388 |
mixdesign
|
18년 전 | 4141 | |
| 1387 | 18년 전 | 2261 | ||
| 1386 | 18년 전 | 4182 | ||
| 1385 |
mixdesign
|
18년 전 | 2169 | |
| 1384 | 18년 전 | 3276 | ||
| 1383 | 18년 전 | 4909 | ||
| 1382 | 18년 전 | 1946 | ||
| 1381 |
오디세우스
|
18년 전 | 3404 | |
| 1380 |
mixdesign
|
18년 전 | 1635 | |
| 1379 | 18년 전 | 2732 | ||
| 1378 |
mixdesign
|
18년 전 | 1658 | |
| 1377 | 18년 전 | 2707 | ||
| 1376 |
|
18년 전 | 2549 | |
| 1375 |
|
18년 전 | 1550 | |
| 1374 |
|
18년 전 | 1489 | |
| 1373 |
|
18년 전 | 1733 | |
| 1372 | 18년 전 | 2236 | ||
| 1371 | 18년 전 | 2012 | ||
| 1370 | 18년 전 | 2376 | ||
| 1369 | 18년 전 | 4913 | ||
| 1368 |
mixdesign
|
18년 전 | 1815 | |
| 1367 | 18년 전 | 1256 | ||
| 1366 | 18년 전 | 1376 | ||
| 1365 | 18년 전 | 1330 | ||
| 1364 | 18년 전 | 1077 | ||
| 1363 | 18년 전 | 1075 | ||
| 1362 | 18년 전 | 1403 | ||
| 1361 | 18년 전 | 1357 | ||
| 1360 | 18년 전 | 2346 | ||
| 1359 | 18년 전 | 1223 | ||
| 1358 | 18년 전 | 1606 | ||
| 1357 | 18년 전 | 2091 | ||
| 1356 | 18년 전 | 1273 | ||
| 1355 | 18년 전 | 2826 | ||
| 1354 | 18년 전 | 1270 | ||
| 1353 | 18년 전 | 1646 | ||
| 1352 | 18년 전 | 1496 | ||
| 1351 | 18년 전 | 1447 | ||
| 1350 | 18년 전 | 1233 | ||
| 1349 | 18년 전 | 1076 | ||
| 1348 | 18년 전 | 1663 | ||
| 1347 | 18년 전 | 1102 | ||
| 1346 | 18년 전 | 3614 | ||
| 1345 | 18년 전 | 1708 | ||
| 1344 |
mixdesign
|
18년 전 | 1788 | |
| 1343 | 18년 전 | 1114 | ||
| 1342 | 18년 전 | 1849 | ||
| 1341 | 18년 전 | 1093 | ||
| 1340 | 18년 전 | 1163 | ||
| 1339 | 18년 전 | 1013 | ||
| 1338 | 18년 전 | 1001 | ||
| 1337 | 18년 전 | 1094 | ||
| 1336 |
|
18년 전 | 2575 | |
| 1335 | 18년 전 | 1544 | ||
| 1334 | 18년 전 | 1636 | ||
| 1333 | 18년 전 | 1201 | ||
| 1332 | 18년 전 | 1871 | ||
| 1331 | 18년 전 | 1517 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기