链接到代码自动 [英] Link to Code Automatic

查看:81
本文介绍了链接到代码自动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有很多我每天都在扫描的PDF文件。我还有自己的网站。



以下是它的 index.html

 < HTML> 
< body>这是我的网站和文档< / body>
< / html>

我想问一下是否可以在代码中创建一个代码当我在FTP服务器上添加一个文件时,index.html 正文。目前我正在使用Filezilla。



这意味着如果我在某个特定文件夹中的服务器上载 .pdf ,它应该自动写入 index.html

 < a href =filename.pdf>文件名< / A> 

有没有插件?

感谢您的帮助

解决方案

  $ files = scandir(__ DIR__); 
$ files = array_diff($ files,array('。','..'));

foreach($ files为$ file){

echo< a href ='。 $文件。 >中。 $文件。 < / A><峰; br> 中;
}




  1. 扫描目录

  2. 删除点

  3. 将文件输出到页面并添加链接


I have lots of PDF files that I scan daily. I also have my own website.

Here's its index.html:

<html>
  <body>This is my site and docs</body>
</html>

I wanted to ask if a code could be made for creating a link in the code of index.html body when I add a file on the FTP server. Currently I am using Filezilla.

It means that if I upload a .pdf on the server in some specific folder, it should automatically write in the index.html.

<a href = "filename.pdf">filename</a>

Is there an addon for this?

Thanks for your help

解决方案

$files = scandir(__DIR__);
$files = array_diff($files, array('.', '..'));

foreach ($files as $file) {

    echo "<a href='" . $file . "'>" . $file . "</a><br>";
}

  1. Scan dir
  2. Remove the dots
  3. Output the files into the page and maybe add a link

这篇关于链接到代码自动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆