简体   繁体   English

在 html 中插入 php 代码 a 标签

[英]insert php code in html a tag

I have a multi language website.我有一个多语言网站。 I have three php files:我有三个 php 文件:

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.变量 TEXT 在每个 lang.php 文件中都有不同的值。

Now, I want to change the name of the .pdf file the same way, but I can't get it to work.现在,我想以同样的方式更改 .pdf 文件的名称,但我无法让它工作。 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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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