如何样刷新缓存文件
怎么样刷新缓存文件
怎么样刷新缓存文件
我在一个循环里写了 判断一下(当数组a的长度小于1时就执行一次) 写进缓存的操作,反之,不执行写进缓存的操作。
问题就出来这儿
当执行到 数组a 小于1时,就写一次缓存b.txt 然后我立既读这个缓存b.txt文件(我用记事本打开b.txt,可以得到正确的内容),而得到的是一个错误的结果 还是数组a的值,并没有变化,只有当我在执行一下这个方法时,才能读到这个b.txt 文件。
我在该怎么做?才能解决这个问题。
------解决方案--------------------
无码无真相
------解决方案--------------------
读之前,使用fclose了吗,另外把问题简单化,把代码从项目中提练出来,(提练本身也是分析问题),然后再测试.
------解决方案--------------------
算我没说,你先看下cache类吧。没人知道它怎么实现缓存了
------解决方案--------------------
问题不出在文件读写,应该检查整个逻辑
当然也不排除你不能通过下面的测试例
- PHP code
file_put_contents('zzz', 'a');$s = file_get_contents('zzz');echo $s;$fp = fopen('zzz', 'w');fwrite($fp, 'b');$fp = fopen('zzz', 'r');echo fgets($fp);<br><font color="#e78608">------解决方案--------------------</font><br>静态方法,$this会有问题吧<div class="clear"> </div>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



IntelTXT is a hardware-assisted security technology launched by Intel. It can ensure the integrity and security of the server during startup by establishing a protected space between the CPU and BIOS. The full name of TXT is TrustedExecutionTechnology, which is Trusted Execution Technology. Simply put, TXT is a security technology that provides hardware-level protection to ensure that the server has not been modified by malicious programs or unauthorized software when it is started. this one

Methods for converting html to txt include using a text editor, using online conversion tools, and using Python programming. Detailed introduction: 1. To open an HTML file, you can use any text editor, such as Notepad, Sublime Text, etc. To select the content of the entire HTML file, you can press the Ctrl+A shortcut key or drag the mouse to select and copy the selection. The content can be copied by pressing the Ctrl+C shortcut or through the copy option in the right-click menu, opening a new TXT file, using the same text editor, etc.

How to solve PHPWarning:fopen():SSLoperationfailedinfile.phponlineX In PHP programming, we often use the fopen function to open files or URLs and perform related operations. However, when using the fopen function, sometimes you will encounter something similar to Warning:fopen():SSLoperationfailedinfile.p

How to solve PHPWarning:fopen():failedtoopenstream:Permissiondenied In the process of developing PHP programs, we often encounter some error messages, such as PHPWarning:fopen():failedtoopenstream:Permissiondenied. This error is usually due to incorrect file or directory permissions

How to solve PHPWarning:fopen():failedtoopenstream:Nosuchfileordirectory In the process of using PHP development, we often encounter some file operation problems, one of which is "PHPWarning:fopen():failedtoopenstream:Nosuchfileordirectory"

chm is converted to txt by using online conversion tools, using browser plug-ins, using command line tools and using third-party software. Detailed introduction: 1. Use the online conversion tool, just upload the CHM file, select the TXT format, and then download the converted TXT file; 2. Use the browser plug-in, after installing the plug-in, just open the CHM file in the browser, and then Click the plug-in button to convert CHM files into TXT format; 3. Use command line tools, etc.

In Matlab, the fopen function is used to open a file and return the file identifier for subsequent reading or writing operations on the file. Select the appropriate permission options to open the file as needed, and promptly close the file when the operation is complete. It should be noted that after opening a file, you need to ensure that the file is closed in time when it is no longer needed to release system resources. In addition, if the file opening fails or an operation error occurs, the error handling mechanism can be used to handle it accordingly.

Pandas is a data analysis tool for Python, especially suitable for cleaning, processing and analyzing data. During the data analysis process, we often need to read data files in various formats, such as Txt files. However, some problems will be encountered during the specific operation. This article will introduce answers to common questions about reading txt files with pandas and provide corresponding code examples. Question 1: How to read txt file? txt files can be read using the read_csv() function of pandas. This is because
