View source code in php

Open Source PHP Source Code Management Software for Windows

Browse free open source PHP Source Code Management Software for Windows and projects below. Use the toggles on the left to filter open source PHP Source Code Management Software for Windows by OS, license, language, programming language, and project status.

Open LMS delivers an effective and engaging learning experience. Open LMS is Open Source at its core. Migrating to Open LMS is simple and easy.

As the largest commercial provider of hosting and support services for the open-source Moodle™ learning platform, we help organizations and institutions deliver great learning experiences without complexities

Authentication Cloud faster, easier, and more user-friendly. Let customers access your online services without passwords and costly SMS fees.

Nevis lets you wow your customers, partners, and employees with excellent authentication and authorization convenience. Nevis offers a single, all-encompassing identity and access management solution for all your identity use cases. With its comprehensive CIAM functions, you can offer your privacy-minded consumers an exceptional user experience, personalized interactions, and the level of secure access to your services that is essential for today’s disruptive, digital transformation demands.

CODEIT-IDE

CODEIT is a simple IDE to develop HTML5 applications directly online in Your browser (best use with Google Chrome). Thanks to the Codemirror library developed by Marijn Haverbeke (codemirror.net) and the initial founder XO Systems, we have created/updated our online IDE with everything you need for the development.

CVSweb-PHP

CVSweb-PHP offers a web interface access to a CVS repository. CVSweb-PHP was created for cases where a project still using CVS has no means of installing a CGI script on its web server, but where running a PHP script is an option.

PHP-Edit

This program is completely stand alone (150 lines of code). A filename may be passed so the editor will open with it’s contents or it can be used without a filename and a default filename will be assigned that may be changed before saving text. For security reasons, no provision has been made to allow saving to another directory. Future additions may include the capability to save to a sub directory.

Читайте также:  Javascript получить массив из json

Источник

PHP show_source() Function

Using a test file («test.php») to output the file with the PHP syntax highlighted:

The browser output of the code above could be (depending on the content in your file):

The HTML output of the code above could be (View Source):

Definition and Usage

The show_source() function outputs a file with the PHP syntax highlighted. The syntax is highlighted by using HTML tags.

The colors used for highlighting can be set in the php.ini file or with the ini_set() function.

show_source() is an alias of highlight_file().

Note: When using this function, the entire file will be displayed — including passwords and any other sensitive information!

Syntax

Parameter Values

Parameter Description
filename Required. Specifies the file to display
return Optional. If set to TRUE, this function will return the highlighted code as a string, instead of printing it out. Default is FALSE

Technical Details

Return Value: If the return parameter is set to TRUE, this function returns the highlighted code as a string instead of printing it out. Otherwise, it returns TRUE on success, or FALSE on failure
PHP Version: 4+
Changelog: As of PHP 4.2.1, this function is now also affected by safe_mode and open_basedir. However, safe_mode was removed in PHP 5.4.
PHP 4.2 — The return parameter was added.

❮ PHP Misc Reference

Источник

View source code using PHP

This tutorial will show you how to take a URL, read in the source code and then format it. The code listed will assume that you are passing the URL as an encoded variable via GET with the name u.

First off here are the CSS styles you’ll need to format the code (you should customise these to suit your needs):

body < background-color: #111111; font-family: Courier New, Courier, mono; font-size: 11px; color: #66CCFF; >span < color: #FFFFFF !important; >.linenumber < color: #FF9900; >em < color: #666666; >h3 < font-family: Arial, sans-serif; text-decoration: none; >.codelink < font-family: Arial, sans-serif; text-decoration: none; font-size: 10px; color: #EEEEEE; >.codelink:hover

Now we to read the HTML in via a HTTP file stream. This is very easy to do, we just use PHP’s file() function.

Читайте также:  Php как установить часовой пояс

Now we’ve got the HTML stored in a variable we need to use htmlentities() to make the source code display the same way through the browser as it would look like if we were to view the source. We then do some string replacement to insert out CSS styles into the HTML so that the tags and the tag contents are different colours:

 $line) < $line = htmlentities($line); $line = str_replace("", ">", $line); $line = str_replace("", "–>", $line); echo "$line_num  : " . $line . "
\n"; > ?>

That’s all there is to it! If you saved this page as viewsource.php then you’d link to it like this:

Tim Bennett is a web designer and developer. He has a First Class Honours degree in Computing from Leeds Metropolitan University and currently runs his own one-man web design company, Texelate.

Источник

How to display PHP source code on the web page?

Whenever you open a PHP file with your server path, it runs the PHP code. It will never display you the PHP source code. Whenever you put some PHP code inside that file, it will run the code instead of showing the source code on the web page.

But suppose you want to show the PHP source with highlighted and with the colors defined then how will you do that? How can you display the highlighted source code on web pages?

Here I am going to tell you how you can do it. I will show you how to display PHP source codes on your web page instead of running it.

Well, there are multiple ways available which can help you to do that. I am now going to tell you four simple and easy ways of displaying the highlighted version of PHP source code with the colors defined. Here are these:

  • Using PHP highlight_string() function
  • Using the show_source() PHP function
  • Using highlight_file() function
  • Use .phps file extension instead of .php
Читайте также:  Scroll with buttons html

Now I am going to give you the example of doing it using each process that I have listed above.

Display highlighted PHP source code using PHP highlight_string() function

The PHP highlight_string() function outputs or returns a syntax highlighted version of the given PHP code using the colors defined in the built-in syntax highlighter for PHP.

Below is the syntax of this function:

highlight_string(string, Return_Boolean)

The string parameter is the required parameter in the above syntax which specifies what to highlight. You have to pass the PHP code through the string.

Below is an example which shows the highlighted version of the given PHP code using the colors defined:

Show PHP source code using highlight_file() function

highlight_file() is also a built in function of PHP which we can use to get the source code of a PHP file. here we just need to give the file path and it will return the complete highlight version of the source code of that PHP file.

Suppose we want to get the source code of a PHP file filename.php, then we can get the source code of filename.php from the below code:

highlight_file('filename.php');

Display source code using the show_source() PHP function

The show_source() PHP function is an alias of: highlight_file() . In this function also you have to pass the PHP file path like that you have just seen in the case of highlight_file() function. Below is the given code which uses show_source() function to get the highlight colored version of the source code of filename.php file:

Get source code using .phps extension

If you want to get the PHP source code directly by opening the URL in your browser then it will never possible as the server will run the codes and it returns the result. But if you use the extension .phps, then it will return you the complete colored and highlighted version of the PHP source code.

I hope you have understood how to show PHP source code on a web page. All the four process I have discussed here are so simple and also understandable. If you like this post then please share it with your friends.

Источник

Оцените статью