누구나 왜이 코드는 워드 프레스의 '페이지 템플릿'에서 실행되지 않습니까?WordPress 페이지 템플릿의 PHP 코드가 실행되지 않습니다
'Echo'는 작동하지만 모든 '포함'과 'print_r()'및 다른 기능은 작동하지 않는 것 같습니다. 이 정확한 코드는 워드 프레스 호스팅 사이트에 내 홈 서버에서 작동하지만 :
<?php
/**
* Template Name: fbshares
*
* A custom page template for displaying all posts.
*
* The "Template Name:" bit above allows this to be selectable
* from a dropdown menu on the edit page screen.
*
* @package WordPress
* @subpackage Twenty_Ten
* @since Twenty Ten 1.0
*/
get_header(); ?>
<div id="container">
<div id="content" role="main" class="fullpagejoel">
<?php
echo "x";
$url = "http://www.google.com";
$social = array(
'twitter' => 'http://cdn.api.twitter.com/1/urls/count.json?url=',
'facebook' => 'https://graph.facebook.com/',
'stumbleupon' => 'http://www.stumbleupon.com/services/1.01/badge.getinfo?url='
);
$json = file_get_contents($social['twitter'].$url, false);
$a = json_decode($json, true);
$r['twitter'] = $a['count'];
print_r($a);
echo count($a).' [OK]';
?>
어떻게 작동하지 않을 수 있습니까? 오류가 있습니까? 'include '는 어디에 있습니까? – hakre
나는 include를 없애고 디버깅을 시도했다. 대신 페이지에 직접 코드를 삽입했습니다 (그곳에서 보았던 부분). 나는 아무 오류도 얻지 않는다. 그냥 "출구". 'error_reporting (E_ALL);을 설정하여 오류 메시지를 표시 할 수 없습니다. – Joel
StackOverflow는 디버깅 서비스가 아닙니다. 오류가 있거나 다른 것을 시도 할 때까지 기다릴 필요가 없습니다. 코드 검토를 시도 할 수 있습니다. – Kermit