2010年6月7日月曜日

PHPのレアな関数

* error_get_last()
(PHP 5 >= 5.2.0)
error_get_last — 最後に発生したエラーを取得する。

* simplexml_load_file()
(PHP 5)
simplexml_load_file — XMLファイルをパースし、オブジェクトに代入する

* PHPバージョン5以上だとini_set()、.htaccessでallow_url_fopenを有効にできない
管理者にphp.iniを変更してもらわなければ file_get_contents() や simplexml_load_file() が使えない。
↓こんな感じのエラーが発生(failed to open steream

Array ( [type] => 2 [message] => file_get_contents(http://twitter.com/statuses/user_timeline/138673716.rss) [function.file-get-contents]: failed to open stream: no suitable wrapper could be found [file] => /virtual/www/2012/lib/twjson.php [line] => 12 )

1 件のコメント:

匿名 さんのコメント...

>>管理者にphp.iniを変更してもらわなければ file_get_contents() や simplexml_load_file() が使えない。
そんな時のcUrl

コメントを投稿