为什么这两个wordpress php块不一样?

This first bit works:

                $my_id = 617;
                $post_id_7 = get_post($my_id); 
                $title = $post_id_7->post_excerpt;
                echo $title;

While this second bit doesn't:

                $post_id_7 = get_post(617); 
                $title = $post_id_7->post_excerpt;
                echo $title;

What gives?

http://codex.wordpress.org/Function_Reference/get_post

You must pass a variable containing an integer (e.g. $id). A literal integer (e.g. 7) will cause a fatal error

yeah what Samuel said.

So if you wrote it:

$post_id_7 = get_post('617');  
$title = $post_id_7->post_excerpt; 
echo $title; 

it should work.