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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools