无法在makefile中检查文件存在

时间:2017-07-01 23:27:43

标签: makefile file-exists

阅读this answer后面的“如何检查Makefile中是否存在文件?”问题,我决定尝试。我在与makefile相同的文件夹中有一个文件// index.html <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div id="popup"></div> <script> $(document).ready(function(){ $('#tableview tbody tr').click(function(){ var a=[]; $(this).find('td').each(function(){ a.push($(this).text()); }); $('#popup').show(); $.ajax({ url:'addfile.php', // HERE's A CRITICAL CHANGE: // val MUST NOT be in quotes. You're creating a plain object here data:{ val: a[1] }, // you can change that from type to method (default is get) - though type is an alias for method, so both should work. method:'post', success:function(res){ // here you have your data back from php, do with that what ever you need. console.log(res); // will show value of a[1] in console // my guess is, you want to show it in #popup $('#popup').html(res); }, error: function(error, status, errorString) { // allways check for possible errors! console.log(error); console.log(errorString); } }); }); }); </script>

代码:

<?php
// adfile.php
if (isset($_POST['val']) && !empty($_POST['val'])) { 
        $value = $_POST['val'];
        echo $value;
} else {
        echo "VALUE IS EMPTY";
}
// don't add a closing tag....

输出:

tact1.pdf

我尝试了文件的完整路径:结果相同。怎么了?操作系统:Windows XP,使用cygwin。

1 个答案:

答案 0 :(得分:0)

删除文件名周围的引号。它们可能在bash或perl中没问题,但在makefile中,它们被认为是文件名的第一个和最后一个字符。

FILE = tact1.pdf