我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

变量内的变量 - PHP

I'm trying to check if a folder is empty or not.

I use an Apache server and a Windows 10 operating system.

What's the problem with my code ?

function is_dir_empty($dir) {
  if (!is_readable($dir)) return NULL; 
  return (count(scandir($dir)) == 2);
}

$dir = "C:/Users/name/.spyder/Python2/data/$day-$month-$year/emptyFolder";
print "<br>$dir<br>";
if (is_dir_empty($dir)) {
  echo "the folder is empty"; 
}else{
  echo "the folder is NOT empty";
}

近期文章

  • PHP - 循环遍历数组中的消息
  • $记录未传递该值
  • 如何在不修改它们的情况下获取所有CRUD Mysql查询的ID?
  • PHP-FPM记录对/index.php Symfony的访问
  • PHP shell_exec访问deb 9上的系统服务
  • 两个非常相似的<select>,一个不保存到DB?
  • Archivve(zip / tar)停止在1GB存档大小(Server Skript)
  • 如何在MYSQL中获得具有子分组的对象数组?
  • 将Coldfusion转换为PHP find('filename.cfm',cgi.script_name)
  • 为什么它在PHP中的条带API上返回null?
  • 带有数据库的模态引导程序中的上一个和下一个按钮
  • 来自管理面板的Magento2备份给出了javascript错误
  • 如何获取data_uri并将其放入变量中
  • 在php中填充数据库中的多个下拉列表
  • ISO 3166-2的Google AdWords位置标准ID
  • Laravel多租户转换问题
  • 集中管理多个应用程序的用户
  • 如何在Yii框架中连接到atlas mongo服务器
  • wordpress插件如何保存设置信息? [重复]
  • 如果条件,如果字段$存在于mongo中的$ group内

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华