php學習筆記(四)插入內容

2021-07-15 14:05:20 字數 866 閱讀 9074

index.php

<?php

if(get_magic_quotes_gpc()) //關閉php的魔術引號功能。

else}}

unset($process);

} //關閉php的魔術引號功能。

if (isset($_get['addjoke']))

//建立連線物件

try

catch (pdoexception $e)

if (isset($_post['joketext']))

catch (pdoexception $e)

exit();

}try

catch(pdoexception $e)

while($aaa = $jieguo->fetch()) //while用來處理大量的資料,fetch將資料集中的下一行作為乙個陣列返回。

include 'joke.html.php';

?>

form.html.php

add-form

joke.html.php

笑話詳情

<?php foreach ($jokes as $joke): ?>

<?php echo ''.htmlspecialchars($joke,ent_quotes,'utf-8').'

'; ?>

<?php endforeach; ?>

新增

exec與execute的區別,物件不同,exec是物件pdo的方法,execute是pdostarement的方法。!!

string資源動態的插入內容

動態的插入內容時候使用,例如,然後通過程式,context.getstring r.string.time,10 05 標籤介紹 屬性id可以隨便命名 屬性example表示舉例說明,可以省略 n ms 代表輸出的是字串,n代表是第幾個引數,設定m的值可以在輸出之前放置空格 n md 代表輸出的是整...

JQuery在游標位置插入內容

原理很簡單,ie下可以通過document.selection.createrange 來實現,而firefox 火狐 瀏覽器則需要首先獲取游標位置,然後對value進行字串擷取處理。不多說了 直接上我寫的乙個jquery在游標位置插入內容外掛程式吧 query在游標位置插入內容外掛程式 funct...

使用選擇器在頁面中插入內容

這裡主要介紹利用before選擇器和after選擇器在頁面中插入內容的方法。1 插入文字 h2 before style 如果要對頁面中個別的h2 標籤前面不新增內容,只需給不需要新增內容的標籤設定樣式,然後設定content none 如下 h2.sample before style 2 插入影...