공유하기 버튼
|
|
|
|
1. Include
- Include 의 대상은 C나 다른 언어처림 파일 내용의 복사가 아닌 대상 파일의 수행
( 현재 수행 환경을 기반으로 ) 해당 파일의 수행 결과를 가져오는 형태,
- 과거엔 require 와 include가 다르게 동작했으나 현재는 완전히 같은 형태인 것으로 보임.
- Include 의 대상은 Web Url이 될 수 있음..
- Include 의 Path 검색 을 환경 변수를 기반으로 하는 것이 가능 한 것으로 보임
2. Java 의 package에 해당하는 것으로 보이는 Namespace는 5.2 이후에 추가됨ref url :: http://www.php.net/manual/en/ini.core.php#ini.include-path
##############################################################
include_path string
Specifies a list of directories where the require(), include(), fopen(), file(), readfile() and file_get_contents() functions look for files. The format is like the system's PATH environment variable: a list of directories separated with a colon in Unix or semicolon in Windows.PHP considers each entry in the include path separately when looking for files to include. It will check the first path, and if it doesn't find it, check the next path, until it either locates the included file or returns with a warning or an error. You may modify or set your include path at runtime using set_include_path().
Example #1 Unix include_path
include_path=".:/php/includes"
Example #2 Windows include_path
include_path=".;c:\php\includes"
Using a . in the include path allows for relative includes as it means the current directory. However, it is more efficient to explicitly use include './file' than having PHP always check the current directory for every include. ##############################################################
5. CLASS 이름은 대소문자를 구분하지 않는다.
6. Class 는 중첩 되지 않는다.
7. Array 는 Array 라기 보다는 map에 가깝다. // This:
$a = array( 'color' => 'red',
'taste' => 'sweet',
'shape' => 'round',
'name' => 'apple',
4 // key will be 0
);
8. foreach 문법으로 class내의 구성요소를 배열 처럼 접근 가능하다
foreach (array_expression as $key => $value)
statement
위 형태에서 array_expression 이 클래스 인스턴스 이름이라면 $key 는 class property $value는 해당 property 의value로 mapping 된다
( 샘플이 회사에...)
|
|
최근 덧글