簡體   English   中英

如何在其他PHP代碼中將PHP代碼顯示為字符串

[英]How to display PHP code as a string inside other PHP code

我需要將此代碼粘貼到管理面板上,然后在網站上顯示Paypal按鈕。

<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="6UKjJ8hU6ML5f">
<input type="hidden" name="custom" value="<?php print($_SESSION['mid'].'-'.$_SESSION['mps']);?>">
<input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

然后,需要使用以下代碼在網站上顯示此代碼。

print $rs->fields("ppbutton");

現在,問題是由於貝寶(Paypal)表單中的PHP代碼,每當我嘗試在網站上打印上述值(貝寶按鈕)時,由於另一個PHP代碼中的PHP代碼而導致錯誤。

我也認為,打印htmlentities($ rs-> fields(“ ppbutton”));

是您的最佳選擇。

您可以從該站點獲取有關該功能的最新更新。

http://php.net/manual/zh/function.htmlentities.php

print htmlentities($rs->fields("ppbutton"));

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM