简体   繁体   中英

insert php code in html a tag

I have a multi language website. I have three php files:

lang.de.php,lang.en.php, lang.hr.php

On index page I am changing text using this line of code:

<h2><?php echo $lang['TEXT'];?></h2>

Variable TEXT has different value in every lang.php file.

Now, I want to change the name of the .pdf file the same way, but I can't get it to work. I want to do something like this:

<a href="downloads/"<?php echo $lang['PDF_FILE'];?>".pdf"></a>

How can I do this?

尝试删除前后的双引号

<a href="downloads/<?php echo $lang['PDF_FILE'];?>.pdf"></a>

执行此操作的正确语法:

<a href="downloads/<?php echo $lang['PDF_FILE']; ?>.pdf"></a>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM