-1
如何從這個輸入的代碼通過$timeframe
變量的值:如何獲取變量的值,內部函數在PHP中:
<input size="2" id="' . $this->get_field_id('timeframe') . '" name="' . $this->get_field_name('timeframe') . '" type="text" value="' . $timeframe . '" />
要低於這個函數代碼:
function filter_where($where = '') {
$where .= " AND post_date > '" . date('Y-m-d', strtotime("-$timeframe days")) ."'";
return $where;}
add_filter('posts_where', 'filter_where');
我已經試過您的解決方案,但它得到了一個錯誤: 警告:缺少論據2 filter_where() – baby 2011-06-10 04:08:18
由你決定。超級全局變量像$ _GET或$ _POST意味着它們可以放在應用程序的任何位置,但我的口味是將定義放在函數之外。 – karim79 2011-06-10 04:11:33
我試過了你的解決方案,但是出現錯誤: 警告:因爲你沒有傳遞第二個參數,所以filter_where() – baby 2011-06-10 04:12:01