| 추천: 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();
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 2230 | 16년 전 | 1288 | ||
| 2229 | 16년 전 | 2161 | ||
| 2228 | 16년 전 | 3222 | ||
| 2227 | 16년 전 | 2165 | ||
| 2226 | 16년 전 | 1749 | ||
| 2225 | 16년 전 | 1508 | ||
| 2224 |
|
16년 전 | 2043 | |
| 2223 | 16년 전 | 4724 | ||
| 2222 | 16년 전 | 1405 | ||
| 2221 |
|
16년 전 | 2142 | |
| 2220 |
|
16년 전 | 2131 | |
| 2219 |
|
16년 전 | 2400 | |
| 2218 |
|
16년 전 | 2145 | |
| 2217 |
|
16년 전 | 4434 | |
| 2216 |
|
16년 전 | 2921 | |
| 2215 | 16년 전 | 2862 | ||
| 2214 | 16년 전 | 1594 | ||
| 2213 | 16년 전 | 1236 | ||
| 2212 |
|
16년 전 | 3942 | |
| 2211 |
|
16년 전 | 1614 | |
| 2210 |
|
16년 전 | 1602 | |
| 2209 | 16년 전 | 2107 | ||
| 2208 | 16년 전 | 1878 | ||
| 2207 |
letsgolee
|
16년 전 | 1489 | |
| 2206 |
|
16년 전 | 3913 | |
| 2205 | 16년 전 | 1753 | ||
| 2204 | 16년 전 | 3133 | ||
| 2203 | 16년 전 | 3019 | ||
| 2202 | 16년 전 | 1041 | ||
| 2201 | 16년 전 | 1844 | ||
| 2200 | 16년 전 | 1589 | ||
| 2199 |
|
16년 전 | 1849 | |
| 2198 |
태양의서쪽
|
16년 전 | 2635 | |
| 2197 |
태양의서쪽
|
16년 전 | 3016 | |
| 2196 |
태양의서쪽
|
16년 전 | 3218 | |
| 2195 | 16년 전 | 3324 | ||
| 2194 | 16년 전 | 1459 | ||
| 2193 |
letsgolee
|
16년 전 | 1417 | |
| 2192 | 16년 전 | 2254 | ||
| 2191 | 16년 전 | 1972 | ||
| 2190 |
|
16년 전 | 2287 | |
| 2189 | 16년 전 | 2808 | ||
| 2188 |
Sizkein
|
16년 전 | 3260 | |
| 2187 |
letsgolee
|
16년 전 | 2356 | |
| 2186 |
Sizkein
|
16년 전 | 1632 | |
| 2185 |
Sizkein
|
16년 전 | 3203 | |
| 2184 |
Sizkein
|
16년 전 | 3061 | |
| 2183 | 16년 전 | 3039 | ||
| 2182 | 16년 전 | 3909 | ||
| 2181 | 16년 전 | 2580 | ||
| 2180 |
|
16년 전 | 2401 | |
| 2179 | 16년 전 | 2650 | ||
| 2178 | 16년 전 | 2894 | ||
| 2177 | 17년 전 | 2612 | ||
| 2176 | 17년 전 | 1451 | ||
| 2175 | 17년 전 | 1892 | ||
| 2174 | 17년 전 | 1485 | ||
| 2173 |
|
17년 전 | 1910 | |
| 2172 | 17년 전 | 2507 | ||
| 2171 | 17년 전 | 8692 | ||
| 2170 | 17년 전 | 3149 | ||
| 2169 | 17년 전 | 4236 | ||
| 2168 |
|
17년 전 | 1977 | |
| 2167 | 17년 전 | 3655 | ||
| 2166 |
|
17년 전 | 1548 | |
| 2165 | 17년 전 | 1383 | ||
| 2164 | 17년 전 | 2319 | ||
| 2163 | 17년 전 | 1314 | ||
| 2162 | 17년 전 | 1637 | ||
| 2161 | 17년 전 | 1454 | ||
| 2160 | 17년 전 | 2525 | ||
| 2159 |
inxps
|
17년 전 | 1491 | |
| 2158 |
inxps
|
17년 전 | 1091 | |
| 2157 | 17년 전 | 1220 | ||
| 2156 | 17년 전 | 3094 | ||
| 2155 | 17년 전 | 2166 | ||
| 2154 | 17년 전 | 1971 | ||
| 2153 |
|
17년 전 | 1219 | |
| 2152 |
letsgolee
|
17년 전 | 2453 | |
| 2151 | 17년 전 | 1170 | ||
| 2150 |
아름다운세상
|
17년 전 | 1124 | |
| 2149 |
아름다운세상
|
17년 전 | 1367 | |
| 2148 |
아름다운세상
|
17년 전 | 2733 | |
| 2147 |
|
17년 전 | 2396 | |
| 2146 | 17년 전 | 2483 | ||
| 2145 | 17년 전 | 1183 | ||
| 2144 | 17년 전 | 1300 | ||
| 2143 | 17년 전 | 3242 | ||
| 2142 | 17년 전 | 2830 | ||
| 2141 | 17년 전 | 4107 | ||
| 2140 | 17년 전 | 2256 | ||
| 2139 | 17년 전 | 2347 | ||
| 2138 | 17년 전 | 1395 | ||
| 2137 | 17년 전 | 2513 | ||
| 2136 | 17년 전 | 2200 | ||
| 2135 | 17년 전 | 2959 | ||
| 2134 |
아름다운세상
|
17년 전 | 2468 | |
| 2133 |
Juinjang
|
17년 전 | 1629 | |
| 2132 | 17년 전 | 2429 | ||
| 2131 | 17년 전 | 1588 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기