Include server-side javascript in PHP
i'm converting in PHP5 a quite old ASP project that was using a lot of server-side javascript.
is there a way to use that code or i'll have to rewrite everything in PHP?
EDIT
th开发者_如何学运维is is how the code is embedded in ASP<!-- #include file=helper.js -->
snippet of my helper.js
<script language=javascript runat=server>
//here are the functions
</script>
then in ASP is see that functions are called as usual ie
response.write myJsfunction()
btw, if i have to rewrite the code, i'll do on my own, not using any software
The answer is "you need to rewrite everything in PHP" PHP does not as is support Javascript on the server-side in reuseable manner. Also, the automatic code transformations are very klunky: clean up work takes more time than building everything by hand from the beginning.
However, you can run server-side Javascript code with tools like node.js and backbone.js. Mixing with PHP code is no-go though as these projects will provide their own, non-PHP-compatible, web-servers.
I presume you mean jscript? Have you tried asp2php?
精彩评论