PHP包括做一些非常奇怪的事情

时间:2015-12-25 08:07:35

标签: php apache

我只是设置了一个新服务器并将我的所有文件移到了一起;在其中我有以下代码行:

include($_SERVER['DOCUMENT_ROOT'].'/config/log.php');

现在如果我把它保留原样,我会收到一个错误,即日志不包括在内,如果我死了(' msg')之前有消息,我会看到消息;如果我死后,我什么也得不到;

P.S。我的道路是正确的;即使它不是我可能会得到一个错误;我不是!

2 个答案:

答案 0 :(得分:0)

如果您在迁移过程中这样做并且路径绝对正确;意味着调试模式中没有包含错误&在日志文件中;那么你可能需要检查包含文件中的代码。

现在,如果该文件使用任何类型的短开标签,例如<?php代替 <!DOCTYPE html> <html> <head> <style> #map { width: 100%; height: 400px; } </style> <script src="https://maps.googleapis.com/maps/api/js"></script> </head> <body> <div id="map" style="width: 1000px; height: 1000px;"></div> <script> /** * @fileoverview Sample showing capturing a KML file click * and displaying the contents in a side panel instead of * an InfoWindow */ var map; /** * Initializes the map and calls the function that creates polylines. */ function initialize() { map = new google.maps.Map(document.getElementById('map'), { center: new google.maps.LatLng(43.6424359, -79.37448849999998), zoom: 2, disableDefaultUI: true, mapTypeId: google.maps.MapTypeId.ROAD }); var layers = []; layers [0] = new google.maps.KmlLayer("http://www.pipeleaks.org/map_files/Line9AB.kml",{ preserveViewport: false, map: map }); layers [1] = new google.maps.KmlLayer("http://www.pipeleaks.org/map_files/Line9FirstNations1.kml",{ preserveViewport: false, map: map }); layers [2] = new google.maps.KmlLayer("http://www.pipeleaks.org/map_files/Line9FirstNations2.kml",{ preserveViewport: false, map: map }); map.set('styles', [ { featureType: 'all', elementType: 'geometry.fill', stylers: [ { visibility: 'off' }, { color: '#000000' } ] }, { featureType: 'landscape.natural.terrain', elementType: 'geometry.stroke', stylers: [ { visibility: 'on' }, { color: '#FFFFFF' }, { weight: 1 } ] }, { featureType: 'landscape.natural.terrain', elementType: 'geometry.fill', stylers: [ { visibility: 'on' }, { color: '#FFFFFF' } ] }, { featureType: 'landscape.natural.terrain', stylers: [ { visibility: 'on' }, ] }, { featureType: 'water', elementType: 'geometry.fill', stylers: [ { visibility: 'on' }, { color: '#365F91' } ] }, { featureType: 'road', elementType: 'geometry', stylers: [ { visibility: 'on' } ] }, { featureType: 'road', elementType: 'labels', stylers: [ { visibility: 'on' } ] }, { featureType: 'poi', elementType: 'geometry', stylers: [ { visibility: 'off' } ] }, { elementType: 'labels.icon', stylers: [ { visibility: 'on' } ] }, { elementType: 'labels.text.stroke', stylers: [ { visibility: 'on' } ] }, { elementType: 'labels.text.fill', stylers: [ { visibility: 'on' } ] } ]); } google.maps.event.addDomListener(window, 'load', initialize); </script>

然后你有两个选择:

  1. 不使用短开标签
  2. Locate php.ini档案和set short_open_tag to on
  3. P.S。别忘了重新启动Apache服务器。

答案 1 :(得分:-1)

您可以尝试(测试)

$path=$_SERVER['DOCUMENT_ROOT'].'/config/log.php';
include $path;