使用php include_once函数

时间:2018-05-02 05:40:06

标签: php angularjs

我正在使用angularjs作为前端而php正在使用后端。我已经编写了一些角度的代码,它在包含header.php函数之前工作正常。但是,在包含header.php之后它不起作用。它不是也有任何错误。我也没有得到我错的地方。

showAllproject.php是,

<?php
  include_once 'C:\wamp64\www\Performance\header\src\demo\header.php';
?>
<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">


<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<!--Angularjs-->
    <script data-require="angular.js@*" data-semver="1.6.9" src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.9/angular.js"></script>
   <script>
        angular.module('myApp', []).controller('namesCtrl', function($scope) {
        $scope.names = [
        {name:'PROJECT'},
        {name:'| DESCRIPTION'},
        {name:'| CREATED ON'},
        {name:'| LAST UPDATED'},
        {name:'| '}
    ];
});
</script>
</head>
<body style="height:100%">
<div class="row" >
    <div class="container-fluid">
        <div class="col-lg-14" style="background-color:#DCDCDC;height:50px;position:fixed">     
        </div>
    <div ng-app="myApp" ng-controller ="namesCtrl" style="background-color:#DCDCDC;height:500px;margin-top:1cm;margin-left:1cm;margin-right:2cm;" class=" row vertical-center-row">
    <div class="col-lg-12" style="background-color:green;height:1cm;">
    <div  class="row">
        <div ng-repeat="x in names" style="margin-right:4cm;margin-left:1cm;" class="col-xs-6">
        {{x.name}}
        </div>
     </div>
     </div>
     <div class="col-lg-12" style="background-color:blue;height:80%;max-height:80%;overflow: auto;">
     <div  class="row">
        <div ng-repeat="x in names" style="margin-right:4cm;margin-left:1cm;" class="col-xs-6">

        </div>
     </div>
     </div> 
     <div class="col-lg-12" style="background-color:green;height:1cm;">
     </div>      
  </div>
 </div>
</div>
</body>
</html>

header.php是,

<?php
//calling methods of methods.php file
include_once 'C:/wamp64/www/performance/header/src/demo/methods.php';
?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">  
    <link rel="shortcut icon" type="image/png" href="http://localhost/performance/login/images/merahkee.png" /> 
    <title> Merahkee Technology Soluctions</title>
    <!-- Bootstrap core CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
    <!-- SmartMenus jQuery Bootstrap 4 Addon CSS -->
    <link href="../addons/bootstrap-4/jquery.smartmenus.bootstrap-4.css" rel="stylesheet">
    <!--Angularjs-->
    <script data-require="angular.js@*" data-semver="1.6.9" src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.7/angular.js"></script>
    <!--This version is for title attribute-->
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.9/angular.js"></script>
    <!--Angularjs starts-->
    <script>
        var rootApp = angular.module('rootApp', ['firstApp','secondApp']);
        var firstApp = angular.module('firstApp', []);
        firstApp.controller('firstController', function($scope) {
          $scope.pageTitle = "MerahkeeCloudMeter";
        });
        var secondApp = angular.module('secondApp', []);
        secondApp.controller('SecondController', function($scope) {
            $scope.Reports="Reports";
        });
        var fourApp = angular.module('fourApp', []);
        secondApp.controller('fourController', function($scope) {
            $scope.Test="Test";
        });
        var thirdApp = angular.module('thirdApp', []);
        secondApp.controller('thirdController', function($scope) {
            $scope.Project="Project";
        });
        var fifthApp = angular.module('fifthApp', []);
        secondApp.controller('fifthController', function($scope) {
            $scope.Report="Report";
        });
        var sixthApp = angular.module('sixthApp', []);
        secondApp.controller('sixthController', function($scope) {
            $scope.default="Default Workspace";
            $scope.details = [
            {name:'help',href:'#'},
            {name:'settings',href:'#'},
            {name:'logout',href:'http://localhost/performance/login/logout.php?logout'}
        ];
        });
        var seventhApp = angular.module('seventhApp', []);
        secondApp.controller('seventhController', function($scope) {
            $scope.sdc_pro = [
            {name:'Show All Projects',href:'http://localhost/performance/showAll_project.php?user_id='},
            {name:'Delete',href:'http://localhost/performance/delete_test.php?user_id='},
            {name:'Create Projects',href:'http://localhost/performance/Create_test.php?user_id='}
        ];
        });
        var eighthApp = angular.module('eighthApp', []);
        secondApp.controller('eigthController', function($scope) {
            $scope.sdc_test = [
            {name:'Show All Tests',href:'http://localhost/performance/showAll_test.php?user_id='},
            {name:'Delete',href:'http://localhost/performance/delete_project.php?user_id='},
            {name:'Create Tests',href:'http://localhost/performance/Project_form.php?user_id='}
        ];
        });
    </script>
    </head>
    <body style="padding-top:80px;">
    <!-- Navbar -->
    <nav class="navbar navbar-expand-lg fixed-top navbar-dark bg-dark">
      <div ng-app="rootApp" class="container">
        <a ng-app = "firstApp" ng-controller = "firstController" class="navbar-brand" href="#">{{ pageTitle }}</a>
         <div class="collapse navbar-collapse" id="navbarNavDropdown">
          <!-- Left nav -->
          <ul class="nav navbar-nav mr-auto">
          <!--Display project dropdown-->
            <li ng-app = "thirdApp" ng-controller = "thirdController" class="nav-item dropdown" style="padding-right:15px;" ><a class="nav-link dropdown-toggle" href="#">{{Project}}</a>
              <ul class="dropdown-menu">
              <?php
                  echo '<li><a class="dropdown-item">Recent Projects </a></li>';
                      for($i=0;$i<$projectcount;$i++){
            //calling test_name() method and storing those values in a string
                        $test=project_name($count_uid,$user_id,$pro_sql);
                        $project_name=$test[$i];

                        if(strlen($project_name)>=25){
                            $projectName=substr($project_name,0,25);
                            $projectName=$projectName.'..';
                            }
                        else{
                            $projectName=$project_name;
                         } 
                        echo'<li><a class="dropdown-item" href="http://localhost/performance/ShowTest_of_project.php?project_name='.$project_name.'&user_id='.$user_id.'" title="'.$project_name.'">'.$projectName.'</a></li>';
                     }//for loops ends

                    //show all projects     
                    echo'<li ng-app = "seventhApp" ng-controller = "seventhController"><a ng-repeat="x in sdc_pro" class="dropdown-item" href="{{x.href}}'.$user_id.'">{{x.name}}</a></li>';
             ?>
             </ul><!--dropdown-menu closes-->
          </li><!--project dropdown ends-->
            <li ng-app = "fourApp" ng-controller = "fourController" class="nav-item dropdown"><a style="padding-right:15px;" class="nav-link dropdown-toggle" href="#">{{Test}}</a>
              <ul class="dropdown-menu">
                  <?php
                      echo '<li><a class="dropdown-item">Recent Tests </a></li>';
                          for($i=0;$i<$testcount;$i++){
                                    //calling test_name() method and storing those values in a string
                                    $test1=recent_test1($test_sql);
                                    $test_name1=$test1[$i];
                                    //project name
                                    $project=recentTest_project($test_sql);
                                    $project_name=$project[$i];
                                    //platform file name
                                    $platform=platform_file();
                                    $platform_file=$platform[$i];

                                    //project id
                                    $project_id=pro_id($test_sql);
                                    $pro_id=$project_id[$i];

                                   //calling file_name() method and storing those values in a string
                                    //$file=load_file_name();
                                    //$file_name=$file[$i];

                                    //echo' <a type="submit" name="testname"  href='.$file_name.'>'.$test_name.'</a><br>';


                                   if(strlen($test_name1)>=25){
                                        $testName=substr($test_name1,0,25);
                                        $testName=$testName.'..';
                                    }
                                     else{
                                        $testName=$test_name1;
                                    }
                            echo'<li><a class="dropdown-item" href="http://localhost/performance/RunTest_09.php?test_name='.$test_name1.'&project_name='.$project_name.'" title="'.$test_name1.'">'.$testName.'</a></li>';
                         }//for loops ends
                    //show all projects ,delete project and create project  
                  echo'<li ng-app = "eighthApp" ng-controller = "eigthController"><a ng-repeat="x in sdc_test" class="dropdown-item" href="{{x.href}}'.$user_id.'">{{x.name}}</a></li>';
                ?>
              </ul>   
            </li><!--test dropdown ends-->
            <li ng-app = "fifthApp" ng-controller = "fifthController" class="nav-item dropdown"><a class="nav-link dropdown-toggle" href="#">{{Report}}</a>
                <ul class="dropdown-menu">
                <li></li>
                </ul>
            </li><!--report list ends-->
          </ul>
          <ul class="nav navbar-nav">
           <li ng-app = "sixthApp" ng-controller = "sixthController"  class="nav-item dropdown"><a class="nav-link dropdown-toggle" href="#">{{default}}</a>
            <ul class="dropdown-menu">
               <li><a ng-repeat="x in details" class="dropdown-item" href="{{x.href}}">{{x.name}}</a></li>
            </ul>
           </li>      
          </ul>
       </div><!--collapse navbar-collapse-->
      </div>
    </nav>
    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
    <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4Si90RDIqNm1" crossorigin="anonymous"></script>
    <!-- SmartMenus jQuery plugin -->
    <script type="text/javascript" src="../jquery.smartmenus.js"></script>
    <!-- SmartMenus jQuery Bootstrap 4 Addon -->
    <script type="text/javascript" src="../addons/bootstrap-4/jquery.smartmenus.bootstrap-4.js"></script>
    <?php
    session_destroy();
    ?>
  </body>
</html>

0 个答案:

没有答案