惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

A
Arctic Wolf
T
Tenable Blog
T
Troy Hunt's Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Privacy & Cybersecurity Law Blog
NISL@THU
NISL@THU
Application and Cybersecurity Blog
Application and Cybersecurity Blog
H
Hacker News: Front Page
S
Secure Thoughts
AWS News Blog
AWS News Blog
L
LINUX DO - 最新话题
D
Darknet – Hacking Tools, Hacker News & Cyber Security
M
MIT News - Artificial intelligence
T
Tor Project blog
S
Schneier on Security
PCI Perspectives
PCI Perspectives
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
美团技术团队
Google DeepMind News
Google DeepMind News
V
Visual Studio Blog
爱范儿
爱范儿
Google DeepMind News
Google DeepMind News
Cyberwarzone
Cyberwarzone
T
The Exploit Database - CXSecurity.com
罗磊的独立博客
T
Threat Research - Cisco Blogs
Recent Commits to openclaw:main
Recent Commits to openclaw:main
V
V2EX
C
CXSECURITY Database RSS Feed - CXSecurity.com
Stack Overflow Blog
Stack Overflow Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
G
GRAHAM CLULEY
L
LINUX DO - 热门话题
D
Docker
J
Java Code Geeks
GbyAI
GbyAI
H
Heimdal Security Blog
The Hacker News
The Hacker News
MongoDB | Blog
MongoDB | Blog
V
Vulnerabilities – Threatpost
T
Tailwind CSS Blog
Cloudbric
Cloudbric
TaoSecurity Blog
TaoSecurity Blog
C
CERT Recently Published Vulnerability Notes
Y
Y Combinator Blog
Recorded Future
Recorded Future
Cisco Talos Blog
Cisco Talos Blog
T
Threatpost
The Register - Security
The Register - Security
Hacker News - Newest:
Hacker News - Newest: "LLM"

WMI

How to Activate MySQL for Multiple Devices - WMI ESLint Flat Config for JS, TS, React, and Prettier - WMI Yarn NPM Registry Configuration - WMI Yarn Guides - WMI Set Up ADB Wireless Debugging on Android: A Full Guide - WMI How to Fill Tax Information on Google Adsense - WMI Migrate ESLint v9 for prettier typescript javascript - WMI PySide6 button click open new window - WMI PySide6 autocomplete input text - WMI Mobile Legends To The Stars Event Clue - WMI [PHP] generate random proxy IP:PORT from CIDR - WMI List of Chrome Driver command line arguments - WMI Happy eid mubarak - WMI Install markdown engine on vite ESM typescript - WMI Android Activity lifecycle - WMI OkHttp cookie handling on android (webview supported) - WMI Turn git log history into markdown - WMI enable automatic memory heap resizing of android studio - WMI is defining screen density can reduce build time ? - WMI
[PHP] generate big text file for testing purpose - WMI
Dimas Lanjaka · 2024-05-10 · via WMI

This script will generate a text file named big_text_file.txt with a size of approximately 10 megabytes.
You can adjust the size by changing the value of $fileSizeMB.
The script generates random strings of characters to fill the file.

<?php
// Function to generate a random string
function generateRandomString($length = 10) {
    $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
    $randomString = '';
    for ($i = 0; $i < $length; $i++) {
        $randomString .= $characters[rand(0, strlen($characters) - 1)];
    }
    return $randomString;
}

// Define the size of the text file in megabytes
$fileSizeMB = 10; // Change this to the desired size

// Open a new text file for writing
$fileName = 'big_text_file.txt';
$file = fopen($fileName, 'w');

// Calculate the number of iterations needed to reach the desired file size
$iterations = $fileSizeMB * 1024 * 1024 / 10; // Assuming each character occupies approximately 10 bytes

// Generate and write random strings to the file
for ($i = 0; $i < $iterations; $i++) {
    $randomString = generateRandomString(100); // Change 100 to adjust string length if needed
    fwrite($file, $randomString . PHP_EOL); // Add a newline character after each string
}

// Close the file
fclose($file);

echo "Text file generated successfully!";
?>