2017-07-27 37 views
0

如何更改我的mPDF Output()的根文件夾?如何更改我的mPDF Output()的根文件夾?

我需要一個從變量中獲取的文件名,並且該文件應該保存在名爲「/ files」的文件夾中。該文件的位置應該在像$location =("/location")這樣的變量中。

現在我的輸出在根文件夾中生成。

$sql=mysql_query("SELECT * FROM `client_details` ORDER BY `c_id` DESC LIMIT 1"); 

while($data = mysql_fetch_array($sql)) 
{ 
    $name=$data['name']; 
} 

$name_p = $name."-estimation.pdf"; 
$mpdf->Output($name_p,'F'); 
+0

定義在PHP的任何文件路徑相同的方式。 – WheatBeak

+0

一些更加詳細的描述加入kindly檢查 – Alshoja

回答

1
$mpdf->Output("/absolute/path/to/directory/" . $name_p,'F'); 

$mpdf->Output("relative/path/to/directory/" . $name_p,'F'); 
+0

我試過但它不工作 – Alshoja

+0

什麼是絕對和相對路徑?我沒有讓你兄弟,對不起,我剛剛對php – Alshoja

+0

$ sql = mysql_query(「SELECT * FROM'client_details' ORDER BY'c_id' DESC LIMIT 1」); ($ data = mysql_fetch_array($ sql)) { $ name = $ data ['name']; } $ name_p \t = \t $ name。「 - estimation.pdf」; $ mpdf->輸出(「temp /」。$ name_p,'F'); 這是當前代碼 – Alshoja

0
$path = __DIR__.'/../../files/'; //til you're at the location of upload 
/* 
//you can use, will return false if incorrect path 
die(realpath($path to make sure you are at the right level)) 
*/ 
//concatenate file path to your file name 
$mpdf->Output($path.$name_p,'F'); 
+0

沒有它沒有工作 – Alshoja

相關問題