Home > Backend Development > PHP Tutorial > 请问字符串拼接

请问字符串拼接

WBOY
Release: 2016-06-13 12:27:14
Original
1190 people have browsed it

请教字符串拼接
我想实现的是这个按钮按下去,如果cat_ID; ?>取到这个ID值,假设为6
则打开http://localhost/myweb/wp-admin/post-new.php?cat=6

我是这么写的:
onclick="window.location.href='./wp-admin/post-new.php?cat=cat_ID; ?>'" 

ID值也取到了,但是总是拼接不上,结果访问一直是:
http://localhost/myweb/wp-admin/post-new.php?cat=


请问这个地方到底怎么写才能实现这个HTML和PHP的混合拼接?

------解决思路----------------------

<br />onclick="window.location.href='./wp-admin/post-new.php?cat=<?php $category[0]->cat_ID; ?>'"<br />
Copy after login


改为:
<br />onclick="window.location.href='./wp-admin/post-new.php?cat=<?php echo $category[0]->cat_ID; ?>'"<br />
Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template