将变量添加到数组内的路径中


Adding a variable into a path inside an array

是否可以在行中添加粗体变量?

$opts = array(
    // 'debug' => true,
    'roots' => array(
        array(
            'driver'        => 'LocalFileSystem',   // driver for accessing file system (REQUIRED)
            **'path'          => '/csgo',         // path to files (REQUIRED)**
            'URL'           => dirname($_SERVER['PHP_SELF']) . '/../files/', // URL to files (REQUIRED)
            'accessControl' => 'access'             // disable and hide dot starting files (OPTIONAL)
        )
    )
);

将其更改为此无济于事

'path'          => ".$folder./csgo",         // path to files (REQUIRED)

谢谢

它应该是:

'path' => "$folder/csgo"

稍微好一点的方法:

'path' => "{$folder}/csgo"

这清楚地显示了变量与字符串的分离