Home  >  Article  >  Backend Development  >  请问字符串拼接

请问字符串拼接

WBOY
WBOYOriginal
2016-06-13 12:27:141139browse

请教字符串拼接
我想实现的是这个按钮按下去,如果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 />


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

Statement:
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