我追加?readmore = true到wordpress的url结尾
<a href="<?php the_permalink(); ?>?readmore=true" class="readmore">
<span><?php _e('Read more','MyProduct'); ?></span>
</a>
Run Code Online (Sandbox Code Playgroud)
但在下一页我尝试了这个
<?php
print_r($_GET);
if($_GET['readmore'] == "true") {
get_header();
}
?>
Run Code Online (Sandbox Code Playgroud)
在我的print_r中
我明白了
Array ( [page_id] => 8?readmore=true )
Run Code Online (Sandbox Code Playgroud)
我错过了关于在wordpress中获取变量的内容
可能重复:
在PHP中从URL解析域
如何得到
http://localhost/
Run Code Online (Sandbox Code Playgroud)
从
http://localhost/something/
Run Code Online (Sandbox Code Playgroud)
用php
我试过了
$base = strtok($url, '/');
Run Code Online (Sandbox Code Playgroud) Array
(
[product_id] => Array
(
[0] => 61
[1] => 62
[2] => 63
)
[product_name] => Array
(
[0] => 44" jesson WIDESCREEN LCD
[1] => 19" jesson WIDESCREEN LCD
[2] => Touchscreen monitor
)
)
Run Code Online (Sandbox Code Playgroud)
我有点困惑如何做这个简单的循环,其中product_id [0]总是匹配product_name [0]等等....我试过
如果我做一个foreach我得到第一个循环是所有product_id我需要打印的名称也....任何想法
我的请求中有这个json
$.get("/shop_possystems/index.php?route=module/cart/ajax_get_individual_prices¤t_id=" + current_id + "&standard_id=" + standard + "&professional_id=" + professional + "&premium_id=" + premium + "&quantity=" + quantity,
function(data) {
var standard_price = data.standard_price;
var professional_price = data.professional_price;
var premium_price = data.premium_price;
console.log(data);
$prettyCheckBox0.text(standard_price);
$prettyCheckBox1.text(professional_price);
$prettyCheckBox2.text(premium_price);
});
Run Code Online (Sandbox Code Playgroud)
问题是data.standard_price返回undefined但在console.log中我有这个
"{"standard_price":"included","professional_price":"add $792.00","premium_price":"add $3372.00"}"
Run Code Online (Sandbox Code Playgroud)
这是怎么回事
可能重复:
使用javascript变量设置PHP变量
我需要做这样的事情
<script type="text/javascript" charset="utf-8">
'<?php $something; ?>' = $(".product_calculation").val();
</script>
<?php
print "from js" . $something;
?>
Run Code Online (Sandbox Code Playgroud)
所以我需要设置一个变量,然后在我设置后直接在下面的php中使用它
我想跑
heroku rake db:migrate
Run Code Online (Sandbox Code Playgroud)
在heroku上运行我的迁移,前两次迁移运行得很好,但第三次迁移看起来像这样
create_table :charities, :options => "ENGINE=MyISAM" do |t|
t.string :name, :null => false
t.string :title, :null => false
t.timestamps
end
add_index :charities, :name
add_index :charities, :title
Migrating to CreateCharitiesAndThemes (20091019140537)
== CreateCharitiesAndThemes: migrating =======================================
-- create_table(:charities, {:options=>"ENGINE=MyISAM"})
rake aborted!
An error has occurred, this and all later migrations canceled:
PGError: ERROR: syntax error at or near "ENGINE"
LINE 1: ..., "created_at" timestamp, "updated_at" timestamp) ENGINE=MyI...
^
: CREATE TABLE "charities" ("id" serial primary key, "name" character …Run Code Online (Sandbox Code Playgroud) jQuery的
$('.left_ul').find('li')
Run Code Online (Sandbox Code Playgroud)
这将返回所有li,但我需要找到带有data ="something"的li
<li>Not me</li>
<li>Not me</li>
<li>Not me</li>
<li>Not me</li>
<li>Not me</li>
<li data='something'>I want this one</li>
<li>Not me</li>
Run Code Online (Sandbox Code Playgroud)
有没有办法轻松做到这一点
好的,所以我在我的opencart应用程序中有这个URL,它运行良好
http://site.com/index.php?route=information/contact
Run Code Online (Sandbox Code Playgroud)
但客户讨厌网址和想要的东西
http://site.com/contact
Run Code Online (Sandbox Code Playgroud)
我想我可以在我的htaccess中做到这一点,一切都会好,但访问网址我什么也得不到
RewriteRule ^(contact)$ index.php?route=information/contact [L,QSA]
Run Code Online (Sandbox Code Playgroud)
有任何想法吗
这是我的htacess
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
RewriteRule ^contact$ /index.php?route=information/contact [L,QSA]
Run Code Online (Sandbox Code Playgroud)