PHP Doku:: Lädt ein neues Wörterbuch mit den Einstellungen einer angegebenen Konfiguration - function.pspell-new-config.html

Verlauf / Chronik / History: (1) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzUnterstützung menschlicher Sprache und ZeichenkodierungPspellPspell Funktionenpspell_new_config

Ein Service von Reinhard Neidl - Webprogrammierung.

Pspell Funktionen

<<pspell_config_save_repl

pspell_new_personal>>

pspell_new_config

(PHP 4 >= 4.0.2, PHP 5)

pspell_new_configLädt ein neues Wörterbuch mit den Einstellungen einer angegebenen Konfiguration

Beschreibung

int pspell_new_config ( int $config )

pspell_new_config() öffnet ein neues Wörterbuch mit den Einstellungen, die in einer mittels pspell_config_create() erzeugten und den pspell_config_*()-Funktionen geänderten Konfiguration angegeben sind. Diese Methode bietet Ihnen die größte Flexibilität und hat die ganze Funktionalität, die pspell_new() und pspell_new_personal() bieten.

Parameter-Liste

config

config ist der Parameter, der von pspell_config_create() beim Erzeugen der Konfiguration zurückgegeben wird.

Rückgabewerte

Gibt bei Erfolg die Kennung eines Wörterbuch-Links zurück.

Beispiele

Beispiel #1 pspell_new_config()-Beispiel

<?php
$pspell_config 
pspell_config_create("de");
pspell_config_personal($pspell_config"/var/dictionaries/custom.pws");
pspell_config_repl($pspell_config"/var/dictionaries/custom.repl");
$pspell_link pspell_new_config($pspell_config);
?>


Ein BenutzerBeitrag:
- Beiträge aktualisieren...
soapergem at gmail dot com
19.08.2008 17:34
Today I ran into an interesting problem that I thought I'd share here to save the next developer that ends up in the same situation a whole lot of trouble. I have been running PHP5 as a FastCGI module on a Windows IIS server, and I recently installed the Aspell library and enabled the pspell extension in my php.ini file. I also installed the English Aspell dictionary. But when I went to use pspell, I was getting ambiguous errors that would terminate script execution without warning.

So I started to break things down, and came to the conclusion that the following code successfully executed its first line, but broke on the last line with the call to pspell_new_config:

<?php

$pspell_config
= pspell_config_create('en');
$pspell_link = pspell_new_config($pspell_config);

?>

This returned a FastCGI error in the browser, with error number -2147467259 (0x80004005). By luck, I happened to think to try the same script via the command line, which gave a much more descriptive error. What happened was that the dictionary installer created the *.dat files in the Aspell\data directory using the Windows standard CRLF "\r\n" instead of the UNIX standard "\n" for line feeds. By changing these all back to the UNIX standard, everything worked. It's apparently very touchy about these line feeds, so if you're wracking your brain over why pspell_new_config is breaking your scripts and you're using a Windows server, start by ensuring that there aren't any extraneous "\r" characters in your dictionary files.



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)