2011-09-30 3 views
0

Drupal 프로젝트에서 실제 파일을 어떻게 참조 하시겠습니까?독립 실행 형 PHP 파일 액세스

PHP 스크립트와 대화해야하는 플래시 앱이 있지만 'http : // {도메인}/{파일 경로}/{파일}'또는 'http : // { domain}/{file} "라고 가정합니다.

더 구체적으로 파일은 /sites/all/flash/postit.php에 있습니다. Drupal은 데이터베이스 기반 컨텐츠를 실제 파일과 어떻게 묶을 것입니까? 당신은 PHP로 참조해야합니다

답변

0

추가 사용 postit.php 경우 다음 구조를 가질 수 포함 :

$cwd = getcwd(); // current dir. usually where index.php running. 
    $file = base_path() ."/sites/all/flash/postit.php"; // path to our script 
    $dir = dirname($file); 
    chdir($dir); // changing to file folder. 
    require_once('postit.php'); 
    // Run your code 
    .. 

    chdir($cwd); // return to own dir. 
0

include "/sites/all/flash/postit.php";

당신은 웹 서버가 PHP 파일을 처리 할 http://domain.com/postit.php으로 포함하려고하면 당신은 얻을 것이다 모두가 HTML 등 포함 산출. 당신은 다음 방식에 포함 할 수 있도록이 파일이 발견되지 않는 오류가 발생합니다,

FOLDER1/someincludefile.php 
someincludefile.php 
postit.php 

등을 위해 상대 경로를 사용

관련 문제