Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/235.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在查询中定义变量(?)_Php_Variables - Fatal编程技术网

Php 在查询中定义变量(?)

Php 在查询中定义变量(?),php,variables,Php,Variables,我必须定义两个变量: <?php $path = 'http://' . $_SERVER['SERVER_NAME'] . '/root/images/folderX/'; $files = scandir('images/folderX/'); ?> 在“folderX”的位置,我应该使用一个来自查询的动态值,如 <?php echo $row_rsQuery["item_name"];?> 怎样才能做到呢 我对php不太熟悉,可能永远也学不到它(

我必须定义两个变量:

<?php 
$path =  'http://' . $_SERVER['SERVER_NAME'] . '/root/images/folderX/'; 
$files = scandir('images/folderX/'); 
?>

在“folderX”的位置,我应该使用一个来自查询的动态值,如

<?php echo $row_rsQuery["item_name"];?>

怎样才能做到呢

我对php不太熟悉,可能永远也学不到它(…太老了…),但我用Dreamweaver解决了我的大部分问题,但是上面的问题超出了它(和我)的能力…

字符串串联(将一个字符串附加到另一个字符串)是通过
操作符完成的:

$path =  'http://' . $_SERVER['SERVER_NAME'] . '/root/images/'.$row_rsQuery["item_name"].'/';   
$files = scandir('images/'.$row_rsQuery["item_name"].'/');
$files = scandir('images/'.$row_rsQuery["item_name"]);

您可以使用与构建
$path
变量相同的方法执行此操作:
scandir('images/'.$row\u rsQuery[“item\u name”]./')
。还是我遗漏了什么?