我可以通过php执行js文件吗? [英] Can I execute js files via php?

查看:87
本文介绍了我可以通过php执行js文件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

接下来的情况是

我有php文件,它可以解析一个网页。该网页上的是电话号码,并且数字相互混合。将每个数字放在正确位置的唯一方法是使用一些JS函数(在客户端)。因此,当我在linux控制台中执行该php文件时,它会提供我所需的一切,除了js函数的结果(难怪-JavaScript不是服务器端语言)。所以我从JS看到的全部-只是我写的代码。

I have php file, which parses a web-page. on that web-page is a phone number and it's digits are mixed with each other. The only way to put each digit on the correct place is to use some JS functions (on the client side). So, when I execute that php file in linux console, it gives me all that I need, except js function's result (no wonder - JavaScript is not a server-side language). So all I see from JS - only a code, that I have written.

问题:我可以通过php执行js文件吗?

The question: can I execute js files via php and how?

推荐答案

快速Google搜索的结果(条款= javascript引擎php

Results of a quick google search (terms = javascript engine php)


  1. J4P5 -自2005年以来未开发[BAD](根据其新闻)

  2. PECL软件包spidermonkey

  3. jeresig在2008年发表的一篇文章指向PHPJS,但看不到何时

  1. J4P5 -- not developed since 2005 [BAD](according to its News)
  2. PECL package spidermonkey
  3. a 2008 post by jeresig points to PHPJS but can't see when it was last updated.

我确定您会在该Google搜索上找到更多链接。

I'm sure you'll find many more links on that google search.

或者:

您说数字是混乱的,您需要使用js对其进行混乱。您可以将解扰逻辑编码为PHP函数并使用它吗?肯定会为您省去很多麻烦,但是如果您要学习的是在PHP中使用js,那么它的故事就完全不一样了。

you say that the digits are scrambled and you need to "unscramble" them using js. Can you code that unscrambling logic into a PHP function and just use it? Will sure save you a lot of trouble, but if learning to use js in php is what you're after, then its a whole different story...

这篇关于我可以通过php执行js文件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆