PHP目录路径使用变量

Wil*_*ans -2 php variables

我有下面的代码应该将文件index.php复制到该目录

$path="/data/www/vhosts/themacsplash.com/httpdocs/ClipBoy/userfiles/";
$fpath="/data/www/vhosts/themacsplash.com/httpdocs/ClipBoy/userfiles/index.php";
$myFolder = $path . $myUser;
$myFolderP = &myFolder."/"."index.php";
Run Code Online (Sandbox Code Playgroud)

我需要$myFolderP这样设置,$myFolder/index.php例如:

/data/www/vhosts/themacsplash.com/httpdocs/ClipBoy/userfiles/will/index.php
Run Code Online (Sandbox Code Playgroud)

我该怎么做?我当前的代码给$myFolderP了我错误:

解析错误:语法错误,意外'.',期待第94行/data/www/vhosts/themacsplash.com/httpdocs/ClipBoy/code/index.php中的T_PAAMAYIM_NEKUDOTAYIM

我相信这很容易解决.

aza*_*zat 5

你必须写这个

$myFolderP = $myFolder."/"."index.php";
Run Code Online (Sandbox Code Playgroud)

而不是这个

$myFolderP = &myFolder."/"."index.php";
Run Code Online (Sandbox Code Playgroud)