2012-11-23 3 views

답변

4

이 파일로 작업을 수행 할 필요가 없습니다 아니오. 없습니다 simplexml_load_file()은 내용을 읽은 후에 파일을 내부적으로 닫습니다.

당신이 simplexml_load_file의 소스 코드를 보는 경우에, 당신이 그것을 다시 읽은 후 파일을 닫습니다합니다 C 기능 xmlReadFile() 폼 xmllib2를 호출하는 것을 볼 수 있습니다.

PHP_FUNCTION(simplexml_load_file) 
{ 
    php_sxe_object *sxe; 
    char   *filename; 
    int    filename_len; 
    xmlDocPtr  docp; 
    char   *ns = NULL; 
    int    ns_len = 0; 
    long   options = 0; 
    zend_class_entry *ce= sxe_class_entry; 
    zend_bool  isprefix = 0; 

    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|C!lsb", &filename, &filename_len, &ce, &options, &ns, &ns_len, &isprefix) == FAILURE) { 
     return; 
    } 

    docp = xmlReadFile(filename, NULL, options); <--- reading the file 
+0

감사합니다. MrCode, 큰 도움이되었습니다 .-) –

1

당신이 다음 fopen()fclose()의 라인을 따라 의미하는 경우에는이 .. 파일을 구문 분석되지 않고이 작업이 완료 후 개체를 설정 해제 할 수 정말 현학적 수 있도록하려면, SimpleXML을하여 객체로 전환 그것으로.

+0

감사합니다. 데일이 도움이되었습니다 .--) –

관련 문제