PHP无法删除目录(PHP cannot delete directory)
我试图删除其中包含文件的文件夹,但以下代码确实删除了文件,但没有删除文件夹。
$nameFolder = $_GET['delete']; $dir = '../projecten/projecten/'.$nameFolder.''; $filesIN = glob($dir."/"."*"); $status = 'false'; foreach($filesIN as $files) //here i take all the files unlink($files); $status = 'true'; if($status=='true'){ rmdir($dir); $status = 'false'; }
I am trying to delete a folder with files inside of it but the following code does delete the files, but not the folder.
$nameFolder = $_GET['delete']; $dir = '../projecten/projecten/'.$nameFolder.''; $filesIN = glob($dir."/"."*"); $status = 'false'; foreach($filesIN as $files) //here i take all the files unlink($files); $status = 'true'; if($status=='true'){ rmdir($dir); $status = 'false'; }
原文:https://stackoverflow.com/questions/16267600
更新时间:2023-06-21 19:06
最满意答案
尝试将此添加到您的maven项目文件:
<dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.6</version> </dependency>
您的application.properties文件只是告诉我们要使用的jpa提供程序。 您仍然必须包含jdbc提供程序实现文件。
Try adding this to your maven project file:
<dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.6</version> </dependency>
Your application.properties file is just telling spring what jpa provider to use. You still have to include the jdbc provider implementation files.
相关问答
更多-
有什么数据库专业书籍介绍?[2022-05-19]
mysql -
据我了解您的问题,您的连接方式不需要OAuth。 您希望服务器使用您已有的凭据连接到Facebook,对吗? 比你必须使用FacebookTemplate连接。 我在一个项目中这样做,我只有
org.springframework.boot spring-boot-starter-web ... -
您没有添加驱动程序类 spring.datasource.driver类名= com.mysql.jdbc.Driver
org.springframework.boot spring-boot-starter-data-jpa mysql ... -
看起来应用程序可能没有运行正确的类路径,因为它似乎很难找到mysql驱动程序。 你是否试图通过IDE运行应用程序? 尝试使用项目目录中的命令行通过maven运行应用程序: ./mvnw spring-boot:运行 如果这可行,那么这是IDE的一个问题,因为某些原因,它在运行应用程序时没有提供正确的类路径。 我对STS并不熟悉,但在IntelliJ中,有些选项(如“自动导入pom”)可让IDE的项目视图与pom同步。 It seems like the application may not be runn ...
-
根据DataSource的超类的源代码 ,当您使用No-Args构造函数实例化DataSource时,底层连接池未初始化。 你必须在DataSource上调用createPool()方法才能初始化它。 我建议您将以下内容添加到@Bean注释中。 @Bean(initMethod="createPool") According to the source code of DataSource's super class when you instantiate the DataSource with the ...
-
属性在基于spring-boot的java应用程序中不起作用(Properties are not working in spring-boot based java application)[2023-06-07]
在spring引导中,您不需要手动读取属性(特别是application.properties )。 application.properties(.yml | .yaml)默认加载到Spring Environemnt类中。 @Component public class PropertyReader { @Autowired private Environment env; public String getHost() { return env.getPro ... -
Acutaly错误已经显示详细信息 您的SQL语法有错误; 查看与您的MySQL服务器版本对应的手册,以便在'选项(id bigint not null auto_increment,value varchar(255),poll_id bigint,p''附近使用正确的语法 如果option是MySQL 5.7中的关键字和保留字,您可以参考MySQL 5.7中的表10.2关键字和保留字 Acutaly the error already show you the detail info You have ...
-
尝试将此添加到您的maven项目文件:
mysql mysql-connector-java 5.1.6 -
如果您在broker.xml中使用消息负载平衡的TRICT值。 那么您需要创建尽可能多的连接,并使用多个节点。 在春天你可以使用MessageListenerContainer来听取消费者。 这里是一个示例应用程序连接到群集(2节点) If you are using TRICT value of message-load-balancing in broker.xml. then you need to create as many connections as many nodes you are us ...
-
我的理解是,只要类路径中有一个受支持的数据源类,spring-boot将使用它,而如果没有指定,则使用tomcat作为首选项。 支持的数据源列表在DataSourceBuilder中给出,目前是tomcat,hikari,dbcp和dbcp2。 您可以通过从应用程序上下文中查找javax.sql.Datasource实现来验证是否已创建一个,但我不明白为什么不会。 https://github.com/spring-projects/spring-boot/blob/master/spring-boot-a ...