第一件事是第一。我不是PHP开发人员,这是我的工作所需要的,所以我接手了,并且我在学习中
现在,我们有一个excel表格,其中包含我们制作的项目的手册链接,这些链接必须手动更新。这可能需要几个小时才能完成。因此,我试图找到一种方法来节省时间。
我可以阅读excel文件以使用javascript获取所需的信息,然后使用ajax调用将其发送到php。
我已确保获得所需的数据,并使其看起来如何在服务器上运行。
我整天都在搜寻Google,以使其正常工作,但我一直空着头。
这是我在php文件中的代码。
<?php
$search = isset($_POST['urlData']) ? rawurldecode($_POST['urlData']) : "Nope Still not set";
$path = $_SERVER['DOCUMENT_ROOT'];
$it = new RecursiveDirectoryIterator( $path );
foreach (new RecursiveIteratorIterator($it) as $file){
$pathfile = str_replace($path,'',$file);
if (strpos($pathfile, $search) !== false) {
echo " pathFile var => ". $pathfile . "| Search var => " . $search;
$encodedUrl = rawurlencode($pathfile .$search);
echo 'link = http://manuals.myCompany.com/'. $doneUrl .'<br>';
}else{
echo "File does not exist => ";
echo $path. "<= Path " . $search."<= …Run Code Online (Sandbox Code Playgroud)