PHP代码混淆HTML? [英] PHP code to obfuscate HTML?

查看:100
本文介绍了PHP代码混淆HTML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道,我知道 - 混淆html / js代码是没用的(我读过其他问题),但我仍然想让我的网站的复制猫变得更加困难......



我正在运行一个基于php的网站,它会生成html输出。我希望最终的html输出(其中有html,js,json和使用ajax)被混淆。有一个用于这个目的的PHP功能吗?我发现了 http://www.ioncube.com/html_encoder.php ,但这依赖于一些他们的特殊软件将被加载到服务器上 - 即,一个不去... ...

任何建议吗?

解决方案

不是真正的混淆,但在大多数情况下很难阅读(并且带宽密集度也较低!)

 <?php 
ob_start();

//在此处生成输出

$ output = ob_get_contents();
ob_end_clean();

$ output = preg_replace('\s {2,}','',$ output);
echo $ output;
?>


I know, I know - obfuscated html/js code is useless (I read the other questions on SO), but I still want to make life harder for copy-cats of my site...

I'm running a php based website, which generates html output. I would like the FINAL html output (which has html, js, json and uses ajax) to be obfuscated. Is there a php function for that purpose? I found http://www.ioncube.com/html_encoder.php but that relies on some of their special software to be loaded on the server - ie, a no-go...

Any suggestions?

解决方案

Not true obfuscation, but rather hard to read in most cases (and less bandwidth-intensive as well!)

<?php
ob_start();

// Generate output here

$output = ob_get_contents();
ob_end_clean();

$output = preg_replace('\s{2,}',' ', $output);
echo $output;
?>

这篇关于PHP代码混淆HTML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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