You can do either - although just to clarify they don't connect directly - they connect to the same WiFi network. The ESP8266 can be set to connect to an existing WiFi network... probably your home network. To do that you'll need to change the SSID & password in the code...
const char* ssid = "test";
const char* password = "test";
I'd probably remove (or comment out) the following line... let the ESP8266 get an IP address from your network instead.
WiFi.config(IPAddress(192,168,1,131),IPAddress(192,168,1,111),IPAddress(255,255,255,0),IPAddress(192,168,1,1));
This statement will show the IP address of the ESP8266 on the network.
Serial.println(WiFi.localIP());
Then from your phone browser try to connect to http:// [ESP8266 IP address] (as above).