2016-04-05 21 views
0

を定義私は今が変数含むパス(PHP)

// set the absolute path to the directory containing the images 
define ("IMGDIR", "./pathsubdir/$article/"); 

パスを定義するために抱き合わせ画像スライドショーに

$article = "This is the title of the slide show images"; 

作業と

define ('IMGDIR', '/articles/" . $article . "/'); 

を試していません仕事(上の両方)

define ('IMGDIR', '/articles/"This is the title of the slide show images"/'); 

これは動作します^

しかし、どのように変数を入れて動作させることができますか? $の記事がdynmaic値であるとして予め

答えて

0

おかげで、あなたが記事

で二重引用符が必要な場合は
define ('IMGDIR', '/articles/"' . $article . '"/'); 

はそれが役に立てば幸い:)

+0

ありがとう

define ('IMGDIR', '/articles/' . $article . '/'); 

を試してみてください............私はそれを試してみましたが、私はそれを試したときに現在のディレクトリの ".."を持っていませんでした。あなたが満足している場合は、回答を受け入れてください: – DOMDocumentVideoSource

+0

ありがとうございました。 – FastTurtle

関連する問題