C JAVA PHP TXT ...读取而不是下载

I have website, and I already can highlight code that is written in HTML.

I can store documents on my website, but when I store document (like .php , .c, , .cpp) I can only download them, not opening in next window.

I need some idea how to pass raw code of that file to another page.

I have apache server and I use PHP

I'm not 100% sure what you're trying, but how about posting the file name to a PHP script and reading the file contents using fopen/fread and then just echo it? You should of course make sure that it'll only output files in a specific folder, so this can't be used to hack your site!

<?php
if(isset($_POST['filename']) && is_allowed_to_be_shown($_POST['filename']))
{
  $filename = $_POST['filename'];
  $handle = fopen($filename, "r");
  $contents = fread($handle, filesize($filename));
  fclose($handle);
  echo $contents;
}
?>

Try accessing the pages ending in .php, .c, .cpp, etc via typing in "localhost/[path to file]" in the address bar. That way the files are read by the sever, before being outputted to the browser, meaning that .php (and the like) files will be handled correctly rather than just HTML files.