View Source Code

  1. Design a PHP script "viewSource.php" so that when you run the script "http://STU.ipv6.club.tw/~username/viewSource.php?fn=filename.php", it will display the source code of "filename.php".
  2. This can be easily done by opening a text file and print it out character by character.
  3. However, please note that some entities must be handled with special care in HTML, such as the "less than" (<) or "greater than" (>) signs.
  4. Test your program with an HTML file containing some tags, or a C++ program like
    
    #include <iostream>
    using std::cout;
    using std::endl;
    
    int main()
    {
        cout << "Hello" << endl;
        return 0;
    }