Posts Tagged ‘php’
[php] – 日本語のテキスト読み込めない時の対処
Parse error: syntax error, unexpected ‘”‘ in /home/sites/heteml/users50/g/b/i/gbinc/web/gb01/yang02/yang02org/log/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()’d code on line 9
php – テストアンケート
_テキストファイル書き込み、読み込み
_正規表現
のテストなど
/
ラジオボックスの項目選んだ瞬間submitさせる
onclick="this.form.submit();"
/
テキストファイルを開いて書き込むプログラム(write.php)
Warning: Cannot modify header information - headers already sent by (output started at /home/sites/heteml/users50/g/b/i/gbinc/web/gb01/yang02/yang02org/log/wp-content/themes/infimum/header.php:2) in /home/sites/heteml/users50/g/b/i/gbinc/web/gb01/yang02/yang02org/log/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()'d code on line 24
/
正規表現を使ってテキストファイルを解析、
投票結果を集計、表示
民主党:0
自民党:65
総投票数:65
PHP – ダブルクォーテーション、シングルクォーテーションの違い:文字列
PHPで文字列を表現するには、
○「”」・・・ダブルクォーテーション
○「’」・・・シングルクォーテーション
の両方を使用できる。
<両者の違い>
○ダブルクォーテーション
括った文字列内に変数があると、変数の内容を反映する。
(変数が認識される)
○シングルクォーテーション
括った文字列内に変数があっても、変数名自体を文字列として反映する。
(変数が認識されない)
(via)http://www.res-system.com/weblog/item/269
php – header info & for test
[http://yang02.org/code/test/php/091204/howmany.php]
<body>
<form method="post" action="header_info.php">
How many "うんこ" do you want?<br/>
<br/>
I want <input type="text" name="num" size="5"> うんこ.<br/>
<br/>
<input type="submit" value="Send">
</form>
</body>
[http://yang02.org/code/test/php/091204/header_info.php]
<body>
<table border="0">
<?php
$aryHeader=array("HTTP_USER_AGENT","HTTP_ACCEPT_LANGUAGE","HTTP_REFERER");
foreach($aryHeader as $name){
?>
<tr>
<th style="color:#FFffFF;background:#ff0000;width:80pt;">
<?php print($name); ?></th>
<td><?php print($_SERVER[$name]); ?></td>
</tr>
<?php
}
?>
</table>
<?php
$testArr=array();
for($i=0;$i<$_POST['num'];$i++){
print("うんこ ");
}
?>
</body>