PHP和Unix-Timestamp

If I use echo date('Y-m-d H:i:s', $unixTime) to get a time and a date for a user to see, does it show the user a GMT time, or a time compatible with the place where he is?

I could use this: new DateTimeZone() and set up a timezone for the user. But what if I don't? Does PHP somehow know the user's timezone?

PHP uses the ini settings for the default timezone, if they are not set, the runtime will produce a warning.

http://php.net/manual/en/datetime.configuration.php

http://php.net/manual/en/function.date-default-timezone-get.php

You can use date_default_timezone_get() to get the current timezone from the ini.

The recommended way for time is to use a DateTime object while specifically setting the timezone for the object.

// use statements for classes outside of our namespace
use DateTime;
use DateTimeZone;

// declare a new DateTime and get the current unix Timestamp
$dt = new DateTime("now", new DateTimeZone("GMT"));
echo $dt->getTimestamp();

Because PHP is a server-side language, any PHP in a file will be processed before being sent over to the client. Therefore, the date function will pull its information from whatever server it is sitting on and will display the time in the server's timezone irrespective of what timezone the client (end user) is in. As mentioned in another answer, you can set the default timezone, but this will remain set and will not change based on the client.