开发者

how can i read a file in php where the file is located on an svn repo?

I have a webpage that needs to be able to read a file for parsing and display content in a table. my html calls ajax calls my php, my php reads the file and parses and sends back the content for the table. I have tested this with the file on my local machine, but I need to be able to read the file when it is in svn. can someone point me in the right direction,

function rFile($fName)
{
    $url = "svnURL"; //my svn url
    $endName = $url.$fName.".sql";
    //echo "$endName";
    if (file_exists($endName))
    {
        //code for parsing  
    }
    else
    {
        echo " no file";

    }

}

this is what I am currently trying... and I always get "no file" so I know that this isnt right plus i t开发者_运维百科hink that I need to add credentials some how. I am grateful for any help and thanks in advance.


Have a look at the pecl extension for svn:

http://php.net/manual/en/book.svn.php

The function you probably want to use is: svn_cat


Worked fine for me:

<?php
echo file_get_contents('https://user:pass@HOST/svn/project/trunk/htdocs/index.php');

Given that I have the APACHE WEBDAV module installed on the HOST for svn access over HTTPS .

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜