Week 11 Flashcards
In the folder structure, where do PHP files go?
o Index goes in the public folder, next to images and stylesheet
o Functions go in the private folder
These are used to insert a PHP files contents into the current file before the server executes anything
Include() and require()
What is the difference between include and require? Include
Include() generates a warning but the script will continue, require generates a fatal error, stopping the script
PHP I/O - file_get_contents(filename)
Contents from a file with made into one large string
PHP I/O - file_put_contents(filename, data, mode)
Write to a file in one large string
PHP I/O - file_exists(filename
Does the file exist
Glob()
Same as Grep. Returns an array of all file names that match a pattern
getcwd()
Get current working directory
cwd think pwd
How can we break a string into an array of strings in PHP?
Explode()
Limited in size by browser, stored on client side, can be disabled
Cookies
Stored on server, limited only by server space. No user modifications, expires when browser is closed.
Sessions - Often identified by a session id (a cookie)
What needs to be called at the top of every page to start a session?
session_start()
JSON stands for
JavaScript Object Notation (
o JSON keys are always
o JSON values can be
Strings; Strings, Numbers, Bools, Objects, Arrays
- Why use JSON objects?
o Transfer data between the server and the client
Simple to use for data