There is way too see php code on web page? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

There is way too see php code on web page?

How can I See My PHP Code When I View Source?

27th Sep 2019, 7:55 AM
Yair
Yair - avatar
28 Answers
+ 9
Nope. PHP produces the HTML you see when you view source, but it is not the source itself. The PHP code is stored on the server, and you can only view it from there.
28th Sep 2019, 6:23 PM
Steam Cheap
Steam Cheap - avatar
+ 11
I don't believe php code can be viewed on the browser. https://www.thoughtco.com/why-dont-see-code-viewing-source-2694210
27th Sep 2019, 9:19 AM
Sonic
Sonic - avatar
+ 7
The php code can be entered and viewed on an editor and stored on the server. Once the page is viewed on the browser, all you see is the resulting html. You can still use an editor on the original source code file to view and modify the PHP.
27th Sep 2019, 9:36 AM
Sonic
Sonic - avatar
+ 6
In fact if you do something like <?php echo "text1 /n <br>"; echo "text2 /n <br>"; the two text's would be seperate lines: 1. On the generated client's side html code because of the /n newline characters. 2. On the rendered html page because of the <br> line break elements
28th Sep 2019, 11:26 AM
SpaceJam♨
SpaceJam♨ - avatar
+ 3
Javascript is alternative
27th Sep 2019, 8:16 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 2
and how then to insert the PHP request into the page?
27th Sep 2019, 9:33 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 2
Yes, I made a little mistake, when you open a file from the server, we see this code, but on the web page the client does not
27th Sep 2019, 10:29 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 2
://You have to look on server panel otherwise you can't view PHP code in View source option
29th Sep 2019, 1:58 AM
Sudarshan Rai
Sudarshan Rai - avatar
+ 1
So i return to my q... How can i see php code of any website in my side...
27th Sep 2019, 10:33 AM
Yair
Yair - avatar
+ 1
and what if you try to download the entire site entirely to your computer? for example using the program WinHTTrack website copier, cyotek webcopy, teleport pro, webcopier...
27th Sep 2019, 10:45 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
You Cannon see php because its server side language, it executed over the server and gives only result to client
27th Sep 2019, 11:13 AM
Ayush Paliwal
Ayush Paliwal - avatar
+ 1
I more in detail googled this question, it turns out this impossible do, need direct FTP access to hosting. the only option is to use ready-made scripts in the public domain
27th Sep 2019, 2:30 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
As I know, we can't see php on web page. Because server generate html code from php to show the contents to the users.
28th Sep 2019, 7:06 PM
Forhad Ahmed Khan
Forhad Ahmed Khan - avatar
0
right click in the browser on an empty space on the web page -> select "view page code"
27th Sep 2019, 7:59 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
I never see php code in that way I mean if i open any web page the php code gone
27th Sep 2019, 8:03 AM
Yair
Yair - avatar
0
not all web pages use this code
27th Sep 2019, 8:05 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
Can you send me web page that use php? That I will try see What the most code that use to alternative php?
27th Sep 2019, 8:11 AM
Yair
Yair - avatar
0
This page made in php <?php $pages = array( 0 => array('title' => 'Первая страница', 'body' => 'Первый текст'), 1 => array('title' => 'Вторая страница', 'body' => 'Второй текст') ); $page_id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; //возьмем номер из запроса if (!isset($pages[$page_id])) $page_id = 0; //проверим что такая страница есть - если нет - 0 по умолчанию $page = $pages[$page_id]; ?> <html> <head> <title><?php echo $page['title'];?></title> </head> <body> <a href="?id=0">Главная</a> <a href="?id=1">Вторая</a> <?php echo $page['body'];?> </body> </html>
27th Sep 2019, 8:21 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
But if i run it and try to see the code...the php will gone
27th Sep 2019, 8:32 AM
Yair
Yair - avatar
0
to run the code you must have a properly configured web server. do you have any idea what this technology is?
27th Sep 2019, 8:35 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar