次のコードを使用して 1500 認証コードを生成しようとしています。
<?php
include "../include/top.php";
$count=1500;
$end=0;
while ($end<$count)
{
//generate an authentication code
$string="ABCDEFGHJKLMNPQRSTUVWXYZ123456789";
$string= substr(str_shuffle($string),5,8) ;
//check whether generated code already exist
$query = "select count(*) from auth where code = '$string' ";
$stmt = prepare ($query);
execute($stmt);
$bind = mysqli_stmt_bind_result($stmt, $count);
check_bind_result($bind);
mysqli_stmt_fetch($stmt);
mysqli_stmt_free_result($stmt);
//If generated code does not already exist, insert it to Database table
if ($count == 0)
{
echo $string."<br>";
$query = "insert into auth (Code) values ('$string')";
$stmt = prepare ($query);
execute($stmt);
$end++;
}
}
?>
生成されたコードはわずか 1024 個で、ブラウザに出力され、データベースに挿入されました。エラーが発生しました:Fatal error: Maximum execution time of 60 seconds exceeded in...... その後、php.ini で max_execution_time の値を 350 に変更し、WAMP を再起動して同じスクリプトを再度実行しましたが、生成されます1000 未満のコードのみで、ブラウザーは 350 秒が完了するまで読み込みを表示し、エラーを生成しました: 致命的なエラー: 350 秒の最大実行時間を超えました......
実際、この方法で 1 ラックのコードを生成したいと考えています。値に対してこのスクリプトを正常に実行する方法
$count=100000