使用jQuery或PHP进行文本比较 - php

我以2个字符串为例,想看看两个字符串的TEXT是否都是EXACT。如果STRING不匹配,它应该显示哪个字符串或原始字符串中缺少的句子。

有可能在jQuery中吗?任何代码?

我尝试使用许多在线文本比较工具,但没有一个说以下字符串是准确的,没有区别,需要忽略段落

文字1

In this chapter, you learn some real time-savers. If you are tired of defining
the same layers, along with units, grid, snap, and ltscale, for each new
drawing, read on. You are about to learn how to create your own template
drawings. With templates, you can begin each new drawing with setups
you have defined and saved in previous MEMA sessions, or with a
variety of predefined setups included in the software.
In addition, you learn to reshape the grid using the LIMITS command
and to copy, move, and array objects on the screen so that you
do not have to draw the same thing twice. We begin with the LIMITS
command, because we want to change the limits as part of defining
your first template.

文字2

In this chapter, you learn some real time-savers. If you are tired of defining the same layers, along with units, grid, snap, and ltscale, for each new drawing, read on. You are about to learn how to create your own template drawings. With templates, you can begin each new drawing with setups you have defined and saved in previous MEMA sessions, or with a variety of predefined setups included in the software.
In addition, you learn to reshape the grid using the LIMITS command and to copy, move, and array objects on the screen so that you do not have to draw the same thing twice. We begin with the LIMITS command, because we want to change the limits as part of defining your first template.** 

参考方案

您正在寻找“ Diff”实现,这并不是完全简单的。 PHP和JavaScript都有可能。

请参阅以下SO问题:

JavaScript based diff utility
PHP text diff script

要查找更多:

Search for "JavaScript diff" on Stack Overflow
Search for "PHP diff" on Stack Overflow

PHP getallheaders替代 - php

我正在尝试从服务器上的apache切换到nginx。唯一的问题是我在PHP脚本中使用的getallheaders()函数,该函数不适用于Nginx。我已经尝试过用户在getallheaders函数上的php站点上提供的注释,但这并不返回所有请求标头。请告诉我如何解决这个问题。我真的想切换到Nginx。 参考方案 您仍然可以使用它,但是您必须像这里一样重新定义…

php Singleton类实例将在多个会话中保留吗? - php

举一个简单的例子,如果我想计算一个不使用磁盘存储的脚本的命中次数,我可以使用静态类成员来执行此操作吗?用户1:<?php $test = Example::singleton(); $test->visits++; ?> 用户2:<?php $test = Example::singleton(); $test->visits+…

PHP:将字符串拆分为字母和数字部分的最佳方法 - php

我有几个格式的字符串AA11 AAAAAA1111111 AA1111111 分离字符串的字母和数字部分的最佳方法(最有效)? 参考方案 如果它们都是一系列字母,然后是一系列数字,并且没有非字母数字字符,那么sscanf()可能比regexp更有效$example = 'AAA11111'; list($alpha,$numeric) =…

php-casperjs获取内部文本 - php

我正在为casperjs使用php包装器-https://github.com/alwex/php-casperjs我正在网上自动化一些重复的工作,我需要访问一个项目的innerText,但是我尚不清楚如何从casperjs浏览器访问dom。我认为在js中我会var arr = document.querySelector('label.input…

PHP strtotime困境 - php

有人可以解释为什么这在我的服务器上输出为true吗?date_default_timezone_set('Europe/Bucharest'); var_dump( strtotime('29.03.2015 03:00', time()) === strtotime('29.03.2015 04:00�…