| 추천: 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();
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 2330 | 16년 전 | 5069 | ||
| 2329 | 16년 전 | 2303 | ||
| 2328 | 16년 전 | 3404 | ||
| 2327 | 16년 전 | 2639 | ||
| 2326 | 16년 전 | 1554 | ||
| 2325 | 16년 전 | 5347 | ||
| 2324 | 16년 전 | 2464 | ||
| 2323 | 16년 전 | 5957 | ||
| 2322 | 16년 전 | 1936 | ||
| 2321 | 16년 전 | 4018 | ||
| 2320 | 16년 전 | 3025 | ||
| 2319 |
|
16년 전 | 2210 | |
| 2318 |
데니크레인
|
16년 전 | 2232 | |
| 2317 | 16년 전 | 4409 | ||
| 2316 | 16년 전 | 3290 | ||
| 2315 | 16년 전 | 2829 | ||
| 2314 | 16년 전 | 2957 | ||
| 2313 | 16년 전 | 2074 | ||
| 2312 | 16년 전 | 1761 | ||
| 2311 | 16년 전 | 1675 | ||
| 2310 | 16년 전 | 1394 | ||
| 2309 | 16년 전 | 1666 | ||
| 2308 | 16년 전 | 1902 | ||
| 2307 | 16년 전 | 1593 | ||
| 2306 |
|
16년 전 | 4845 | |
| 2305 | 16년 전 | 3821 | ||
| 2304 | 16년 전 | 1785 | ||
| 2303 | 16년 전 | 1525 | ||
| 2302 | 16년 전 | 2264 | ||
| 2301 | 16년 전 | 4527 | ||
| 2300 | 16년 전 | 3540 | ||
| 2299 | 16년 전 | 2574 | ||
| 2298 | 16년 전 | 4328 | ||
| 2297 | 16년 전 | 3200 | ||
| 2296 | 16년 전 | 1351 | ||
| 2295 |
|
16년 전 | 1372 | |
| 2294 |
|
16년 전 | 2035 | |
| 2293 | 16년 전 | 1881 | ||
| 2292 | 16년 전 | 2557 | ||
| 2291 | 16년 전 | 2229 | ||
| 2290 | 16년 전 | 1362 | ||
| 2289 | 16년 전 | 4389 | ||
| 2288 | 16년 전 | 1471 | ||
| 2287 | 16년 전 | 1777 | ||
| 2286 | 16년 전 | 2198 | ||
| 2285 |
|
16년 전 | 3832 | |
| 2284 |
|
16년 전 | 2728 | |
| 2283 |
|
16년 전 | 1483 | |
| 2282 | 16년 전 | 4010 | ||
| 2281 |
|
16년 전 | 1388 | |
| 2280 | 16년 전 | 1573 | ||
| 2279 | 16년 전 | 1234 | ||
| 2278 | 16년 전 | 1709 | ||
| 2277 | 16년 전 | 1610 | ||
| 2276 | 16년 전 | 1622 | ||
| 2275 | 16년 전 | 1422 | ||
| 2274 | 16년 전 | 2179 | ||
| 2273 | 16년 전 | 1814 | ||
| 2272 |
|
16년 전 | 1960 | |
| 2271 | 16년 전 | 2176 | ||
| 2270 |
a1system
|
16년 전 | 1466 | |
| 2269 | 16년 전 | 2303 | ||
| 2268 | 16년 전 | 2253 | ||
| 2267 | 16년 전 | 4525 | ||
| 2266 |
|
16년 전 | 1292 | |
| 2265 | 16년 전 | 1045 | ||
| 2264 |
잠자리똥꾸멍
|
16년 전 | 2007 | |
| 2263 |
태양의서쪽
|
16년 전 | 1970 | |
| 2262 |
태양의서쪽
|
16년 전 | 1509 | |
| 2261 |
태양의서쪽
|
16년 전 | 2036 | |
| 2260 |
|
16년 전 | 2267 | |
| 2259 | 16년 전 | 1380 | ||
| 2258 | 16년 전 | 1734 | ||
| 2257 | 16년 전 | 1921 | ||
| 2256 | 16년 전 | 1007 | ||
| 2255 | 16년 전 | 1686 | ||
| 2254 | 16년 전 | 1402 | ||
| 2253 | 16년 전 | 1904 | ||
| 2252 |
freedays
|
16년 전 | 1321 | |
| 2251 | 16년 전 | 2197 | ||
| 2250 | 16년 전 | 1878 | ||
| 2249 | 16년 전 | 5861 | ||
| 2248 | 16년 전 | 1909 | ||
| 2247 | 16년 전 | 3681 | ||
| 2246 | 16년 전 | 1465 | ||
| 2245 |
|
16년 전 | 1752 | |
| 2244 |
|
16년 전 | 2068 | |
| 2243 | 16년 전 | 2606 | ||
| 2242 | 16년 전 | 2303 | ||
| 2241 | 16년 전 | 2752 | ||
| 2240 | 16년 전 | 2986 | ||
| 2239 | 16년 전 | 3006 | ||
| 2238 |
|
16년 전 | 1817 | |
| 2237 |
|
16년 전 | 1535 | |
| 2236 |
|
16년 전 | 1409 | |
| 2235 | 16년 전 | 1723 | ||
| 2234 | 16년 전 | 1203 | ||
| 2233 | 16년 전 | 1958 | ||
| 2232 |
|
16년 전 | 1731 | |
| 2231 | 16년 전 | 1604 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기