2010年04月17日 過去Blog
# stripcslashes() —- C言語と同様にバックスラッシュでクォートされた文字列を元に戻す # htmlentities() —- 適用可能な文字を全てHTML エンティティに変換する # nl2br() —- 改行文字の前にHTMLの改行タグを挿入する # strip_tags() —- 文字列からHTMLタグ、および PHPタグを取り除く
$text はフォームから受け取る文字列。 // HTML文字のエスケープ $text = htmlspecialchars( $_POST[“messege”] ); // magic_quotes_gpcの値がONなら削除 if ( get_magic_quotes_gpc() ) { $text = stripslashes( $text ); } // 改行処理 $text = nl2br($text); print_r($text); これでフォームから送信された文章内の改行をそのまま表示させることが出来る。

この投稿へのコメント

コメントはまだありません。

コメントを残す

メールアドレスが公開されることはありません。

次のHTML タグと属性が使えます。
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

CAPTCHA


ピックアップ記事

NSAssert,NSAssert2

2011年04月13日 過去Blog
NSAssert 指定した条件が間違っていればlogに文字列を書き込む NSAssert2 指定した条件が間違っていればlogに引数2つの文字列を書き込む http://www.oomori.com/cocoafw/Foundation/NSAssert2/NSAssert2.html free raspberry ketones…
「NSAssert,NSAssert2」をはてなブックマークに追加

PHP 配列の要素を指定し、キーを取り出す

2010年04月14日 過去Blog
配列の要素の値から、そのキーを取り出す場合。 <?php $array = array(0 => 'blue', 1 => 'red', 2 => 'green', 3 => 'red'); $key = array_search('green', $array); // $key = 2; $key = array_search('red', $array); // $key = …
「PHP 配列の要素を指定し、キーを取り出す」をはてなブックマークに追加

addressbook内のデータをtableViewに表示させる

2011年01月17日 過去Blog
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusab…
「addressbook内のデータをtableViewに表示させる」をはてなブックマークに追加

UIDatePickerの取得する時間がずれる

2011年05月03日 過去Blog
以下のサイトを参考に [ui_picker setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"GMT"]]; のようにすると日付の誤差はなくなりましたが、時刻の誤差はそのままでした。 http://pukapuka-ahirusan.blogspot.com/2010/11/uidatepicker.html どうやら、UIDatePicke…
「UIDatePickerの取得する時間がずれる」をはてなブックマークに追加
© graffiti on the web . All rights reserved. WordPress Theme by comfy