| 추천: 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();
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 1330 | 18년 전 | 1486 | ||
| 1329 | 18년 전 | 1718 | ||
| 1328 | 18년 전 | 1000 | ||
| 1327 | 18년 전 | 1422 | ||
| 1326 | 18년 전 | 2258 | ||
| 1325 | 18년 전 | 1142 | ||
| 1324 | 18년 전 | 1303 | ||
| 1323 | 18년 전 | 1567 | ||
| 1322 | 18년 전 | 1178 | ||
| 1321 | 18년 전 | 970 | ||
| 1320 | 18년 전 | 1194 | ||
| 1319 | 18년 전 | 1523 | ||
| 1318 | 18년 전 | 1649 | ||
| 1317 | 18년 전 | 1600 | ||
| 1316 | 18년 전 | 1210 | ||
| 1315 |
|
18년 전 | 8603 | |
| 1314 | 18년 전 | 1909 | ||
| 1313 | 18년 전 | 1495 | ||
| 1312 | 18년 전 | 1487 | ||
| 1311 | 18년 전 | 1782 | ||
| 1310 | 18년 전 | 1836 | ||
| 1309 | 18년 전 | 1226 | ||
| 1308 | 18년 전 | 985 | ||
| 1307 | 18년 전 | 2759 | ||
| 1306 | 18년 전 | 3110 | ||
| 1305 | 18년 전 | 2172 | ||
| 1304 | 18년 전 | 1556 | ||
| 1303 | 18년 전 | 1423 | ||
| 1302 | 18년 전 | 893 | ||
| 1301 | 18년 전 | 1780 | ||
| 1300 | 18년 전 | 5139 | ||
| 1299 | 18년 전 | 2857 | ||
| 1298 |
mixdesign
|
18년 전 | 2110 | |
| 1297 | 18년 전 | 3079 | ||
| 1296 | 18년 전 | 2546 | ||
| 1295 | 18년 전 | 2240 | ||
| 1294 |
onweb
|
18년 전 | 4560 | |
| 1293 |
onweb
|
18년 전 | 3491 | |
| 1292 | 18년 전 | 3456 | ||
| 1291 | 18년 전 | 4042 | ||
| 1290 | 18년 전 | 1905 | ||
| 1289 | 18년 전 | 1760 | ||
| 1288 | 18년 전 | 1731 | ||
| 1287 | 18년 전 | 1428 | ||
| 1286 | 18년 전 | 1264 | ||
| 1285 | 18년 전 | 1158 | ||
| 1284 | 18년 전 | 1159 | ||
| 1283 | 18년 전 | 1514 | ||
| 1282 | 18년 전 | 915 | ||
| 1281 | 18년 전 | 1271 | ||
| 1280 | 18년 전 | 1129 | ||
| 1279 | 18년 전 | 1147 | ||
| 1278 | 18년 전 | 3026 | ||
| 1277 | 18년 전 | 948 | ||
| 1276 | 18년 전 | 1157 | ||
| 1275 | 18년 전 | 2096 | ||
| 1274 | 18년 전 | 2225 | ||
| 1273 | 18년 전 | 1321 | ||
| 1272 | 18년 전 | 1914 | ||
| 1271 | 18년 전 | 1163 | ||
| 1270 | 18년 전 | 2497 | ||
| 1269 | 18년 전 | 6597 | ||
| 1268 |
페이지팩트
|
18년 전 | 3821 | |
| 1267 |
페이지팩트
|
18년 전 | 2229 | |
| 1266 |
|
18년 전 | 6294 | |
| 1265 | 18년 전 | 2586 | ||
| 1264 | 18년 전 | 2621 | ||
| 1263 | 18년 전 | 2122 | ||
| 1262 | 18년 전 | 2118 | ||
| 1261 |
페이지팩트
|
18년 전 | 2124 | |
| 1260 | 18년 전 | 3887 | ||
| 1259 |
|
18년 전 | 3935 | |
| 1258 |
|
18년 전 | 5038 | |
| 1257 | 18년 전 | 4138 | ||
| 1256 | 18년 전 | 2575 | ||
| 1255 | 18년 전 | 1811 | ||
| 1254 | 18년 전 | 2782 | ||
| 1253 | 18년 전 | 2717 | ||
| 1252 | 18년 전 | 2239 | ||
| 1251 | 18년 전 | 5417 | ||
| 1250 |
jbsstyle
|
18년 전 | 4763 | |
| 1249 |
|
18년 전 | 3773 | |
| 1248 | 18년 전 | 3453 | ||
| 1247 | 18년 전 | 2140 | ||
| 1246 | 18년 전 | 2136 | ||
| 1245 | 18년 전 | 3640 | ||
| 1244 |
|
18년 전 | 2283 | |
| 1243 |
|
18년 전 | 2494 | |
| 1242 | 18년 전 | 1768 | ||
| 1241 | 18년 전 | 4464 | ||
| 1240 | 18년 전 | 2154 | ||
| 1239 | 18년 전 | 2304 | ||
| 1238 | 18년 전 | 4042 | ||
| 1237 |
hwatta
|
18년 전 | 3893 | |
| 1236 | 18년 전 | 2117 | ||
| 1235 | 18년 전 | 2768 | ||
| 1234 | 18년 전 | 5145 | ||
| 1233 | 18년 전 | 2412 | ||
| 1232 |
|
18년 전 | 2952 | |
| 1231 | 18년 전 | 8503 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기