当数组为空时,CFileHelper::findFiles方法停止

当数组为空时,CFileHelper::findFiles方法停止,file,yii,File,Yii,我正在使用CFileHelper::findFiles()方法列出特定目录下的所有文件。当目录不为空时,它可以正常工作。但是,如果它下面没有文件,该方法会突然停止,没有错误消息或异常。对这个问题有什么想法吗 编辑: public function actionIndex() { /** * @var Supplier $supplier */ $data = $this->getRequestData();

我正在使用CFileHelper::findFiles()方法列出特定目录下的所有文件。当目录不为空时,它可以正常工作。但是,如果它下面没有文件,该方法会突然停止,没有错误消息或异常。对这个问题有什么想法吗

编辑:

public function actionIndex()
    {
        /**
         * @var Supplier $supplier
         */
        $data = $this->getRequestData();
        $supplier = Supplier::model()->findByPk($data['id']);
        if (isset($supplier)) {
            $files = $supplier->getCertificateFilesList();
            $response = new LabResponse();
            $response->addRegion('certificates-wrapper', $this->renderPartial('partial/_thumbnails', array(
                'supplier' => $supplier,
                'files' => $files
            ), true));
            $this->sendHttpResponse(200, $response->getResponse());
        }
        $this->sendHttpResponse(404);
    }

public function getCertificateFilesList()
    {
        $dir = 'uploads/suppliers/certificates/11';
        $files = CFileHelper::findFiles($dir);
        return $files;
    }

如果目录为空,它将返回空数组。@naveengoyal那么为什么它会在我的代码中停止?您如何处理代码中的空数组?你能发布那个代码吗?我想当我为空文件夹调用这个方法时,它卡在了一个无限循环上。因为调用后apache将不再响应。请发布调用此方法的代码以及应用程序如何处理返回值。