The correct answer is: B. He said that last night he had a wonderful dream.
The sentence “He said, ‘I had a wonderful dream last night'” is in the past tense. This means that the speaker is talking about something that happened in the past. In this case, the speaker is talking about a dream that he had the previous night.
Option A is incorrect because it uses the present tense. The speaker is not saying that he is seeing a dream right now, he is saying that he had a dream in the past.
Option C is incorrect because it uses the perfect tense. The speaker is not saying that he had had a dream at some point in the past, he is saying that he had a dream last night.
Option D is incorrect because it uses the simple past tense. The speaker is not saying that he saw a dream yesterday, he is saying that he had a dream last night.
In conclusion, the correct answer is: B. He said that last night he had a wonderful dream.