我正在研究我目前的项目,突然间我遇到了这个致命的错误,对我来说根本没有任何意义。我和我的上传类在同一个文件夹中有一堆类,但只有当我尝试实例化上传类时,我才会收到此错误,所有其他类都可以正常工作。
我的自动加载课程:
<!DOCTYPE html>
<html>
<head>
<title>Remove Markers</title>
<style>
#map {
height: 100%;
}
html, body {
height: 100%;
margin: 0;
padding: 0;
}
</style>
</head>
<body onload='refreshDiv()'>
<div id="map"></div>
<p>Click on the map to add markers.</p>
<script>
var map;
var markers = [];
//this is were the problem lies**
function refreshDiv()
{
clearMarkers();
var position = new google.maps.LatLng(37.769,-122.446);
addMarker(position);
var refresher = setTimeout('refreshDiv()', 3000);
}
function initMap() {
//var haightAshbury = {lat: 37.769, lng: -122.446};
var haightAshbury = new google.maps.LatLng(37.769, -122.446);
map = new google.maps.Map(document.getElementById('map'), {
zoom: 12,
center: haightAshbury,
mapTypeId: 'terrain'
});
// This event listener will call addMarker() when the map is clicked.
// Adds a marker at the center of the map.
addMarker(haightAshbury);
}
// Adds a marker to the map and push to the array.
function addMarker(location) {
var marker = new google.maps.Marker({
position: location,
map: map
});
markers.push(marker);
}
// Sets the map on all markers in the array.
function setMapOnAll(map) {
for (var i = 0; i < markers.length; i++) {
markers[i].setMap(map);
}
}
// Removes the markers from the map, but keeps them in the array.
function clearMarkers() {
setMapOnAll(null);
}
// Shows any markers currently in the array.
function showMarkers() {
setMapOnAll(map);
}
// Deletes all markers in the array by removing references to them.
function deleteMarkers() {
clearMarkers();
markers = [];
}
</script>
<script async defer
src='https://maps.googleapis.com/maps/api/js?key=AIzaSyBVQaENEYHY2g-mRhD6_tj1cSK8DhQoqHI&callback=initMap'>
</script>
</body>
</html>
这就是我实例化上传课程的方式:
<?php
require_once('config.php');
function __autoload($class_name) {
$new_class_name = strtolower($class_name);
$class = explode("_", $new_class_name);
$path = implode("/", $class).".php";
require_once($path);
}
很奇怪,除了这里看到的所有其他课程都完全加载。我尝试加载Upload类的页面本身称为upload.php这可能是一个原因,我也尝试将名称更改为Uploading但仍然是同样的错误。
完全错误:
致命错误:未捕获错误:类&#39;上传&#39;找不到 /Applications/MAMP/htdocs/site/al/pages/upload.php:6堆栈跟踪:
0 /Applications/MAMP/htdocs/site/inc/core.php(7):require_once()#1 /Applications/MAMP/htdocs/site/al/index.php(6):Core-&gt; run ()#Appins/MAMP/htdocs/site/al/pages/upload.php中抛出#2 {main}
第6行
我在Mac上运行php 7并使用MAMP,正如您从错误中看到的那样。我期待至少有人指出我正确的方向,以及为什么只有这个课程不会加载。