将php文件添加到wordpress主题会发出内部服务器错误

时间:2012-07-20 21:29:08

标签: php wordpress wordpress-plugin wordpress-theming

当我请求将PHP文件添加到WordPress主题时,我收到以下错误,但是当从wp主题外部(直接在根目录)请求文件时,该文件正常工作。将新的PHP文件添加到WordPress主题时是否需要遵循特殊步骤?

结果错误:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@yajoop.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

以下是javascript代码,要求ajax请求页面getRout.php

function showRout(path,flat,flng,tlat,tlng)
{
        var fullPath= path+ "/library/map/getRout.php";
       // showLoader();
        var instructions;
        var path = [];
    $(document).ready(function(){
            $.ajax({
                type: "GET",
                url: fullPath,
                dataType: "json",
                data: { flat:flat,flon:flng,tlat:tlat,tlon:tlng },
                success: function(json) {
                                     alert("ok");
                                        var pathCoordinates = new google.maps.MVCArray();
                                        var bounds = new google.maps.LatLngBounds();
                                        infowindow = new google.maps.InfoWindow();
                                        pathCoordinates.clear();
                                        /// add points to polyline                                  
                                        $.each(json.route_geometry,function(i,f){
                                            var point = new google.maps.LatLng(parseFloat(f[0]),parseFloat(f[1]));                                          
                                                pathCoordinates.insertAt(i,point);                          
                                                bounds.extend(point);
                                        });
                                        $.each(json.route_instructions,function(i,f){
                                        if(f[0] !="undefined")
                                            instructions += "<div class='step'>"+f[5]+" : "+f[0]+"</div>";
                                        });

                                            $("#rout-distance").html("Distance : "+(json.route_summary.total_distance/1000) + "km");
                                            $("#rout-time").html("Time : "+ Math.round((json.route_summary.total_time/60)) + "min");
                                            $(".small-col-right").slideDown();


                                            $("#instruction-col1-rout").html(instructions);
                                            map.fitBounds(bounds);

                                         //delete old
                                            if(poly){
                                                poly.setMap(null);
                                            }

                                        var polyOptions = { 
                                            path: pathCoordinates, 
                                            strokeColor: '#ff0000', 
                                            strokeOpacity: 0.6, 
                                            strokeWeight: 5
                                        };

                                        poly = new google.maps.Polyline(polyOptions); 
                                        poly.setMap(map,function(){
                                        hideLoader();
                                });

                }
            });
        });

}  

这里调用javascript函数时

<input type="button" value="" class="b_getdirection" onclick="showRout('<?php echo get_template_directory_uri(); ?>',31.5064963,34.4365743,31.5374006,34.5063466)" />

getRout.php在~/wp-content/themes/GeoPlaces/library/map/

0 个答案:

没有答案