English 中文(简体)
缩略语
原标题:Insert php variable in a href
  • 时间:2011-11-24 11:43:39
  •  标签:
  • php
  • href

我计划插入一个PHP变量,为存储在我的Windows机器上的档案提供目录。 我如何把这一变量列入我的实验室文字中的<代码>href标签,这样,当用户点击这一链接时,就应当将其转至该特定文件夹。

For ex: $rafter_path = C:docs estfile1.txt ;

我现在尝试了一些不同的方式,但没有成功。 我还对互联网进行了一些研究,但地图集找不到适当的答案。

If any one has an idea would be thankful if it can be shared. Thanks

最佳回答
echo  <a href="  . $folder_path .  ">Link text</a> ;

请注意,你必须使用与贵领域相对的道路,如果双重的道路不在公共的笔记中,则不会奏效。

EDIT: maybe i misreaded the question; you have a file on your pc and want to insert the path on the html page, and then send it to the server?

问题回答

你可以尝试:

<a href="<?php echo $directory ?>">The link to the file</a>

Or for PHP 5.4+ (<?=?

<a href="<?= $directory ?>">The link to the file</a>

但是,你的道路与服务器相对,不忘记这一点。

iii

echo  <a href="  . $folder_path .  ">Link text</a> ;

<a href="<?=$folder_path?>">Link text</a>;

<a href="<?php echo $folder_path ?>">Link text</a>;

使用<条码>印刷/编码功能或目录操作员

http://php.net/manual/en/Function.printf.php





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签