关于PHP安全模式的问题:
默认情况下,它在PLESK共享主机帐户环境中打开:虽然在我的网站上似乎工作正常,但它可能会更快/更好地关闭时工作?我不太了解下面的文字,特别是PHP的解释:
PLESK:
默认情况下,PHP配置为在具有功能限制的安全模式下运行.在启用安全模式的情况下,某些Web应用程序可能无法正常工作:如果站点上的应用程序因安全模式而失败,请关闭安全模式
PHP.net:
自PHP 5.3.0起,此功能已被弃用.非常不鼓励依赖此功能.PHP安全模式试图解决共享服务器安全问题.尝试在PHP级别解决此问题在架构上是不正确的,但由于Web服务器和操作系统级别的替代方案不太现实,许多人,特别是ISP,现在使用安全模式.
问题1:何时/出于什么原因人们会将安全模式打开?
问题2:何时/出于什么原因人们应该保持安全模式关闭?
这个PHP RGB亮度改变功能部分工作:

它最后错过了一个零"0":所以它应该是"00"如何解决这个问题?
$color = "#a7a709"; // constant
$color1 = brightness($color,+25); // brighter, echoes #c0c022, correct RGB value
$color2 = brightness($color,-25); // darker echoes #8e8e0, incorrect RGB value!!
Run Code Online (Sandbox Code Playgroud)
如何解决这个问题?非常感激!
功能亮度();
### CREDITS go to Cusimar9 who wrote this
function brightness($colourstr, $steps) {
$colourstr = str_replace('#','',$colourstr);
$rhex = substr($colourstr,0,2);
$ghex = substr($colourstr,2,2);
$bhex = substr($colourstr,4,2);
$r = hexdec($rhex);
$g = hexdec($ghex);
$b = hexdec($bhex);
$r = max(0,min(255,$r + $steps));
$g = max(0,min(255,$g + $steps));
$b = max(0,min(255,$b + $steps));
return '#'.dechex($r).dechex($g).dechex($b); …Run Code Online (Sandbox Code Playgroud) 即使在Google PageSpeed(97)和Yahoo! 获得非常高的分数之后 YSlow(92)PHP生成的缩略图似乎并不是从旧缓存中被动地传递出来的:它们似乎每次都会被生成......而且......再次......新鲜出炉消耗大量的腰部时间.
这个问题将只关注如何解决生成拇指的PHP代码的CACHE问题:
只要看看这些微小的微小缩略图,每个只有3~5 kb!
瀑布详情:http://www.webpagetest.org/result/110328_AM_8T00/1/details/
任何和所有建议都是+1给我的帮助,并热烈欢迎,因为我已经在这个问题上变得非常绝望的过去几个月.Thanx一千!
使用或不使用Modrewrite不会影响速度:两者都相同.我使用这些重写条件:RewriteCond %{REQUEST_URI} ^/IMG-.*$ & RewriteCond %{REQUEST_FILENAME} !-f
无论是最初的默认网址还有美化重写URL产生相同的延迟!因此,让我们不要将故障指向闪电般快速的Apache:它的PHP Cache /标题以某种方式错误编码......

webpagetest.org警告:利用静态资产的浏览器缓存:69/100
失败 - (没有最大年龄或过期):http://aster.nu/imgcpu? src =aster_bg/124.jpg&w = 1400&h = 100&c = p
每次刷新后,您都会在REDbot.org上随机看到这两个警告中的任何一个

// Script is directly called
if(isset($_GET['src']) && (isset($_GET['w']) || isset($_GET['h']) || isset($_GET['m']) || isset($_GET['f']) || isset($_GET['q']))){
$ImageProcessor = new ImageProcessor(true);
$ImageProcessor->Load($_GET['src'], true);
$ImageProcessor->EnableCache("/var/www/vhosts/blabla.org/httpdocs/tmp/", …Run Code Online (Sandbox Code Playgroud) 一个疯狂的问题:
想象一个名为somepage.php
And 的网页文件,它在我的编辑器中包含一些html php内容,我看到:
<html><head></head><body>
<?=$welcome . $essay . $thatsAllForNowFolks . $footer ?>
<!--
Blue
Ball
Bell
Blow
Bows
Bats
Beef
Bark
Bill
Boss
-->
</body></html>
Run Code Online (Sandbox Code Playgroud)
当我浏览我的网站时,我在最终结果中看到了这些评论,而我只希望评论只出现在我的编辑器中,因为我的秘密灵感并且不希望全世界都知道我在开发时的想法,以及我看到任何和所有我的网站访客的评论作为互联网速度浪费的bandwitch.
在提供HTML时,如何对整个html/php文件进行解除?非常感谢您的想法,代码和建议.我提前感谢...
在返回当前访问者信息/ IP的所有这些函数中,只有第一个似乎输出:
echo $_SERVER["REMOTE_ADDR"];
echo $_SERVER["HTTP_X_FORWARDED"];
echo $_SERVER["HTTP_X_CLUSTER_CLIENT_IP"];
echo $_SERVER["HTTP_FORWARDED_FOR"];
echo $_SERVER["HTTP_FORWARDED"];
Run Code Online (Sandbox Code Playgroud)
主要问题:为什么其他功能不输出任何东西?
奖金问题:在这方面是否还有其他很酷的功能,例如输出访客使用的浏览器和平台的功能?同样有用的是在#RGB中获取访客城市,最喜欢的饮料,最喜欢的颜色...... :)感谢您的任何建议!
想象一下十六进制的有效#RGB颜色,定义为 $color = "#f7b9a0";
现在我想让PHP从这种颜色中得到另外两种颜色,这些颜色稍微更亮/更暗(相同的色调/颜色,但只是改变了亮度).我有什么方法可以实现这一目标 什么代码会生成这个?我觉得我需要一些简单的东西:
brightness(input rgb color, ± number of steps); // function outputs the new RGB
// ?? What php code should go here??
Run Code Online (Sandbox Code Playgroud)
理想情况下,我希望在我的html中有这样的东西:
.classDefault {color:<?=$color?> }
.classLighter {color:<?=brightness($color,+10)?> } /* 10 steps brighter */
.classDarker {color:<?=brightness($color,-25)?> } /* 25 steps darker */
Run Code Online (Sandbox Code Playgroud)
该代码应该包含哪些PHP代码brightness();?为了我的梦想成真?
任何建议和/或代码都非常感谢!
function alter_brightness($colourstr, $steps) {
$colourstr = str_replace('#','',$colourstr);
$rhex = substr($colourstr,0,2);
$ghex = substr($colourstr,2,2);
$bhex = substr($colourstr,4,2);
$r = hexdec($rhex);
$g = hexdec($ghex);
$b = hexdec($bhex);
$r = max(0,min(255,$r …Run Code Online (Sandbox Code Playgroud) 除了设置页面语言的明显方式:
<meta name="language" content="de"><html lang="de">
Run Code Online (Sandbox Code Playgroud)
我最近发现了一个典型的方面,只有PHP的编程语言可以使开发人员在PHP文件的最顶层设置语言:
<?php
/* Set and pre-define the language in the header;
* Eliminating guesswork for the Header language.
*/
header('Content-language: de');
?>
Run Code Online (Sandbox Code Playgroud)
PHP程序员经常出现两个问题:
主要问题:什么时候应该在PHP标头中设置语言?
SideQ1:大网站不打扰使用它:为什么不呢?
SideQ2:搜索引擎会听这个吗?如果有的话,这个PHP标题有什么影响?
鉴于以下php5代码输出了大量难以阅读的代码:
<?=var_dump($_SERVER);?>
<?=print_r($GLOBALS); ?>
Run Code Online (Sandbox Code Playgroud)
问题:如何使输出更具人性化?例如,在新线路上只有每个"项目"吗?
当谷歌通过名为Closure Compiler的方便工具中缩小JavaScript时,它会出现以下错误(并且不会缩小某个内容):
错误数:1 JSC_TRAILING_COMMA:解析错误.IE8(及以下)将错误地解析数组和对象文字中的尾随逗号.如果您要定位较新版本的JS,请设置相应的language_in选项.在all.js的第389行第1字符
theme : 'default', // The theme of the slider (default, theme1, theme2, t...
Run Code Online (Sandbox Code Playgroud)
$(window).load(function(){
jQuery('#slider1').autoSlider({
theme : 'default', // The theme of the slider (default, theme1, theme2, theme3)
width : '960', // The width of the slider, 100% for auto full width, set to 0 it will take the width of the largest image
autoHidePlayBtn : true, //
Run Code Online (Sandbox Code Playgroud) 我想使用环回自动增加 mongodb 文档编号。
我在 mongo 中做了功能
function getNextSequence(name) {
var ret = db.counters.findAndModify(
{
query: { _id: name },
update: { $inc: { seq: 1 } },
new: true
}
);
return ret.seq;
}
db.tweet.insert(
{
"_id" : getNextSequence("userid"),
"content": "test",
"date": "1",
"ownerUsername": "1",
"ownerId": "1"
}
)
Run Code Online (Sandbox Code Playgroud)
它在 mongo shell 中工作。
但是,当我使用 loopback.js 浏览器(http://localhost:3000/explorer/)插入时,它不起作用。显示 400 错误(SytaxError)代码。
我不能在环回休息 API 中使用 mongo 函数?
我认为问题是这一行中的引号getNextSequence("userid"),
php ×8
colors ×2
performance ×2
rgb ×2
.htaccess ×1
arrays ×1
brightness ×1
caching ×1
comments ×1
header ×1
hex ×1
html ×1
increment ×1
ip ×1
javascript ×1
loopbackjs ×1
minify ×1
mongodb ×1
multilingual ×1
orientation ×1
readability ×1
safe-mode ×1
strongloop ×1
zero ×1