Target: I want to make a PHP editor with preview (and can easily insert a page).
Action:
- Search (Google or Baidu) did not find any ready-made answers.
- Codemirror found in the search, I think it should be OK.
- Then download and unzip Codemirror (5.2version) to D-disk, D:\codemirror-5.2.
- In D:\codemirror-5.2\demo, there are many demos, of which preview.html is more appropriate.
- Open preview.html with chrome, test JavaScript and HTML, all OK.
- I would like this effect (preview.html), but to PHP version, so I copy preview.html, and named Phppreview.html, put in D:\codemirror-5.2\demo.
- In notepad++ open phppreview.html, follow the steps below to modify it.
- Line 3, changed title to codemirror:php Preview.
- After line, add a new line:
.
- Line PNs and 42,change "HTML5 preview" to "PHP Preview".
- Line A, change mode from "Text/xml" to "application/x-httpd-php".
- no other changes, open phppreview.html in Chrome, test PHP code, code output and code highlighting are not working!
Questions: I want to insert a PHP editor with a preview function (implemented with CODEMIRROR) in a page, how to make? What is wrong with the above steps? or what steps need to be added?
Thank you very much!
Note: The issue has been submitted in StackOverflow but has not received a reply for two weeks. Hope in Segmentfault can get enthusiastic expert guidance!
HTML editor with preview:
PHP editor with preview:
You might want http://3v4l.org. /
As far as I do, Codemirror is just an editor, except editor, you say the function must have a suitable sandbox environment to execute PHP code, the editor must be unable to execute the PHP code
such as https:// Github.com/fieryprophet/php-sandbox seems to be able to use the
You can take a look at this demo and hope it works for you:
Http://www.365mini.com/diy.php?f=jquery-on-de Mo
PHP is a service-side language that cannot be previewed by clients alone. You can make a button and then Ajax to the server to run, of course, to set security issues.
& #xe63a;