当我添加functions.php时,为什么我的媒体库会消失?

I am very new to wordpress themes and php. So please bear with me... I am following along in the book "Learn to Create Wordpress themes by creating Five Projects" and creating a theme called "simple". I am also running on AMPPS environment.

Here is the problem: the next step in the book is to add a functions.php page, then add the following code so that I can use Featured Image Support:

<?php function simple_theme_setup() {
add_theme_support('post-thumbnails');
}
add_action('after_setup_theme','simple_theme_setup') ?>

There is nothing else in the functions.php file (other than the basics like body, head, etc). However, when I then try to upload an image from the site, I get "An error occurred in the upload. Please try again later." Also, the media library is empty with just a wheel spinning.

When I change themes to one of wordpress's default themes, the media library is there. And the file that I tried to upload before (when I got the error message) is also there, in that other theme. So the file I uploaded is being displayed for other themes. But in the simple theme it isn't there and I get the error message.

So then I found out that if I remove the functions.php file from the simple theme, the media library re-appears and I assume I can upload images too (though I can't add featured images obviously). Once I return the functions.php file, I can no longer see the media library and I can't upload images. I was curious to see if it was a specific line of code in the functions.php file (maybe I typed something wrong), but it turns out if I leave the functions.php file blank, with no code other than the basics, I still have the problem! It seems that the mere existence of the functions.php file is causing the media library to disappear (and when I try, being unable to upload images).

I've tried all the suggestions for the error message "An error occurred in the upload. Please try again later." I re-installed wordpress, I tried various code suggestions...but nothing works. And again, its something to do with that functions.php file only for this new theme I created. Am I missing some code that needs to be in the functions.php file to make it all work? Or is something else going on?

You have a syntax error in your PHP. Try adding a semicolon at the end of this line, like this:

add_action('after_setup_theme','simple_theme_setup');

I figured it out. I'm using Dreamweaver and dreamweaver automatically creates HTML headings, title, etc. I'm not too fluent in PHP so I didn't realize that the functions.php page needed to have that stuff deleted. Once I deleted it and put ONLY the PHP code in it, it worked.