Rufen Sie zu undefined Function Readline ()Php

PHP-Programmierer chatten hier
Anonymous
 Rufen Sie zu undefined Function Readline ()

Post by Anonymous »

Wenn ich versuche,
zu schreiben

Code: Select all

$choice = readline();< /code>
Es zeigt mich < /p>
Fatal error: Uncaught Error: Call to undefined function readline()
Aber für andere Leadlines, wie $ title = readline ("title:") Es wird mir keine Fehler angezeigt. Was ist die Ursache? Ich verwende PHP -Version 8.4.0 < /p>
Wie kann ich es beheben, ohne längere Codes zu schreiben (wenn möglich)?

Code: Select all

do {
echo "\n\n";
echo "1 - show all books\n";
echo "2 - show a book\n";
echo "3 - add a book\n";
echo "4 - delete a book\n";
echo "5 - quit\n\n";
$choice = readline();

switch ($choice) {
case 1:
foreach ($books as $id => $book) {
displayBook($id, $book);
}

break;
case 2:
$id = readline("Enter book id: ");
displayBook($id, $books[$id]);

break;
case 3:
addBook($books);
break;
case 4:
deleteBook($books);
break;
case 5:
echo "Goodbye!\n";
$continue = false;
break;
case 13:
print_r($books); // hidden option to see full $books content
break;
default:
echo "Invalid choice\n";
};

} while ($continue == true);

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post