search
Homephp教程php手册file_put_contents 错误:failed to open stream: Invalid argument 一种原因

今天在测试nilcms系统的时候,出现了一个报错,导致缓存无法更新:

file_put_contents(C:\UPUPW_AP5.4\vhosts\d.tv\NilCMS_APP\include_run/config_site.php): failed to open stream: Invalid argument C:\UPUPW_AP5.4\vhosts\d.tv\NilCMS_20160520\core\common.php 129

测试环境使用的是win7 64位,使用UPUPW的环境套件。

生成文件使用的是file_put_contents函数,该目录下其他文件生成没有任何问题,只有config_site.php无法写入。纠结呀。。。

分析过程:

1.config_site.php 文件在nilcms系统运行前会直接加载,会不会影响了写入?经过测试加载文件,然后修改它,是没有任何问题的。

2.各种找问题,各种纠结,感到无语。

3.发现引入config_site.php 文件时使用的函数是require_once。改成require后发现,生成缓存没有问题了。问题解决。

一些备注:

1.使用自己搭建的wamp环境(XWAMP)没有遇到这样的问题。

2.使用linux虚拟主机环境也没有遇到这样的问题。

3.为什么更换这个函数能解决这个问题的原理,我不知道,知道的朋友可以分享下。

4.心情好很多了^_^

 

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Hot Tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft