dpg76975 2015-04-27 21:09
浏览 43
已采纳

使用CodeIgniter和PHP在get_filenames函数内部变量

With the following code I am trying to get the file name inside MY_PIC folder and then to print it but is not possible.

$this->load->helper('file');
$uid = 10;  
$files = get_filenames('./MAINDIRECTORY/<? echo $uid; ?>/MY_PIC');
print_r($files);

The only way to get the filename is the following:

$this->load->helper('file');    
$files = get_filenames('./MAINDIRECTORY/10/MY_PIC');
print_r($files);

Does any other way that can I use the variable $uid?

  • 写回答

1条回答 默认 最新

  • drzbc6003 2015-04-27 21:13
    关注

    What you want here is to concat a string with a variable :

    $uid = 10;
    $files = get_filenames('./MAINDIRECTORY/' . $uid . '/MY_PIC');
    

    Hope this help ;)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?