000webhost:我网站的网址似乎无法正常工作

时间:2014-07-26 13:54:02

标签: php web-hosting

我在000webhost.com上创建并托管了以下网站 Click Here to visit the site

问题是索引页面加载正确且正常,但我已设置 header.php 的导航链接以通过名为 pages.php 的控制器加载,因为我无法调用视图的直接URL。它在我的localhost中工作正常,但是当我托管它时,它不会导致我无处可去。请帮我解决这个问题。

我的config.php

<?php 

$config['base_url'] = 'http://doit-tech.tk/'; // Base URL including trailing slash (e.g. http://localhost/)

$config['default_controller'] = 'main'; // Default controller to load
$config['error_controller'] = 'error'; // Controller used for errors (e.g. 404, 500 etc)

$config['db_host'] = 'mysql5.000webhost.com'; // Database host (e.g. localhost)
$config['db_name'] = '********'; // Database name
$config['db_username'] = '*******'; // Database username
$config['db_password'] = '*******'; // Database password

?>

我的header.php

<!DOCTYPE html>
<html lang="en">
   <head>
      <meta charset="utf-8" />
      <title>Welcome to PIP</title>
      <meta name="description" content="">
      <meta name="author" content="">
      <link rel="stylesheet" href="<?php echo BASE_URL; ?>static/css/style.css" type="text/css"/>
   </head>
   <body>
      <div class="level gradient shadowmkr">
         <div class="headerarea">
            <div class="col4"><img src="<?php echo BASE_URL; ?>static/images/DoIT Logo.png" width="300" height="75" /></div>
            <div class="col8">
               <div id="nav">
                  <div id="nav_wrapper">
                     <ul>
                        <li><a href="<?php echo BASE_URL; ?>pages/viewpage/index">HOME</a>
                        </li>
                        <li>
                           <a href="#">COURSES</a>
                           <ul>
                              <li><a href="<?php echo BASE_URL; ?>pages/viewpage/course-java-programming">Java Programming with Software Engineering Concepts</a>
                              </li>
                              <li><a href="<?php echo BASE_URL; ?>pages/viewpage/course-web-designing">Web Designing for Beginners</a>
                              </li>
                              <li><a href="#">Web Application Development with PHP &amp; MySQL</a>
                              </li>
                              <li><a href="<?php echo BASE_URL; ?>pages/viewpage/course-qa-pm">Software QA &amp; Project Management</a>
                              </li>
                              <li><a href="#">Computer &amp; IT for Beginners</a>
                              </li>
                           </ul>
                        </li>
                        <li>
                           <a href="#">SOLUTIONS</a>
                           <ul>
                              <li><a href="#">Products</a>
                              </li>
                              <li><a href="#">Services</a>
                              </li>

                           </ul>
                        </li>
                        <li> <a href="<?php echo BASE_URL; ?>pages/viewpage/contact-us">CONTACT US</a>
                        </li>
                     </ul>
                  </div>
                  <!-- Nav wrapper end -->
               </div>
               <!-- Nav end -->
            </div>
         </div>
      </div>
   </body>
</html>

我的pages.php控制器

<?php

class Pages extends Controller {

    function index()
    {

    }

    function viewpage($page){

       $template = $this->loadView($page);
       $template->render();

    }

}

?>

1 个答案:

答案 0 :(得分:-2)

我没有看到在任何地方调用的pages.php,你可以将页面作为参数传递给pages.php:

http://doit-tech.tk/pages.php?/viewpage/course-web-designing

或者pages.php应该作为索引存在于文件夹中,但不存在:

http://doit-tech.tk/pages/viewpage/course-web-designing/pages.php

如果停留在您的域中,则不需要基本URL,相对路径比绝对路径容易得多。