Faker生成假數據的 PHP 庫
Faker 是一個為你生成假數據的PHP庫。當你需要填充一個測試數據庫,或為你的web應用生成測試數據時,它能派上用場。
示例代碼:
<?php // require the Faker autoloader require_once '/path/to/Faker/src/autoload.php'; // alternatively, use another PSR-0 compliant autoloader (like the Symfony2 ClassLoader for instance) // use the factory to create a Faker\Generator instance $faker = Faker\Factory::create(); // generate data by accessing properties echo $faker->name; // 'Lucy Cechtelar'; echo $faker->address; // "426 Jordy Lodge // Cartwrightshire, SC 88120-6700" echo $faker->text;
評論
圖片
表情
