Skip to Content
PHP 5 Kochbuch, Third Edition
book

PHP 5 Kochbuch, Third Edition

by David Sklar, Adam Trachtenberg, Carsten Lucke, Matthias Brusdeylins, Ulrich Speidel, Stephan Schmidt
September 2009
Intermediate to advanced content levelIntermediate to advanced
912 pages
48h 11m
German
O'Reilly Verlag
Content preview from PHP 5 Kochbuch, Third Edition

19.3 Das Default-Locale setzen

Problem

Sie möchten ein Locale setzen, das alle Ihre PHP-Programme verwenden können.

Lösung

Am Anfang einer Datei, die über die Konfigurationsdirektive auto_prepend_file geladen wird, rufen Sie setlocale( ) auf, um Ihr gewünschtes Locale zu setzen:

setlocale(LC_ALL,'es_US');

Um die Locale-Einstellung wieder auf die Systemeinstellung zurückzusetzen, rufen Sie setlocale() mit NULL als zweitem Parameter auf:

setlocale(LC_ALL, null);

Diskussion

Auch wenn Sie vor dem Start Ihres Webservers oder des PHP-Programms entsprechende Umgebungsvariablen setzen, ändert PHP sein Locale nicht, bis Sie setlocale( ) aufrufen. Nachdem Sie die Umgebungsvariable LC_ALL auf es_US gesetzt haben, fährt PHP beispielsweise immer noch das voreingestellte ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

PHP programmieren unter Windows

PHP programmieren unter Windows

Arno Hollosi

Publisher Resources

ISBN: 9783868993271Purchase book