简体   繁体   中英

Php project from windows 7 to ubuntu 12.04

I've created a php project which lists the files-directories inside the root directory, lets the user to navigate through the subfolders search for file name and other. My trouble is that altough in windows it works well in linux there are many problems. the first problem that i'm trying to solve is that the CSS(folder css is in the same directory with index.php) isn't used so the site isn't shown correctly. To run it in linux i installed php5 apache2 and open_jdk_7. In windows the root was C:\\webdev\\apache\\htdocs. Now in linux(if i've understood right you use "/" instead of "\\") the root path is /var/www. I will post the code of index that works on windows if it can help to figure this out. The only thing i changed was to use define("ROOT", "/www/var"); i've also read something about permissions on linux but i didnt understood well maybe theres the probem. thank you for your time.

<?php      
    define("SUBFOLDER","");
    define("ROOT","C:\webdev\apache\htdocs");
?>

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<link href="<?php echo SUBFOLDER."/"; ?>css/myCSSfile.css" rel="stylesheet" type="text/css"> 
<link rel="shortcut icon" href="<?php echo SUBFOLDER."/"; ?>images/dit.ico">
<link rel="stylesheet" href="<?php echo SUBFOLDER."/"; ?>css/search.css">
<link rel="stylesheet" href="<?php echo SUBFOLDER."/"; ?>css/button.css">
<link rel="stylesheet" href="<?php echo SUBFOLDER."/"; ?>css/button2.css">
<script type="text/javascript" src="<?php echo SUBFOLDER."/"; ?>js/resolutionfinder.js"></script>
<script type="text/javascript" src="<?php echo SUBFOLDER."/"; ?>js/changeInputValue.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo SUBFOLDER."/"; ?>js/ajaxcalls.js"></script>





<body onload='ShowDivInCenter();' onresize='ShowDivInCenter();'>
    <div class="cont">
        <div id="main">
            <?php
                error_reporting(E_ALL);
                if ($_GET['action']=="view"){
                   include_once("foldercontents.php");
                }
                else if ($_GET['action']=="downloadZip"){
                    include_once("downloadZip.php");
                }
                else if ($_GET['action']=="downloadfile"){
                    include_once("download.php");
                }
                else {
                    include_once("foldercontents.php");
                }
            ?>
        </div>
    </div>
</body>

如果要使用的CSS文件夹与索引文件位于同一目录中,则可以相对引用它:

<link href="css/myCSSfile.css" rel="stylesheet" type="text/css">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM