我想更改XAMPP的htdocs目录.我按照说明从这个问题创建了一个虚拟主机:
这在Windows 7上工作正常,但是当我在OSX上尝试时,转到mysite.local只会加载xampp启动画面(mysite.local/xampp/index.html).我重新启动了Web服务器.我在httpd-vhosts.conf中声明的虚拟主机是:
<VirtualHost *:80>
DocumentRoot Users/username/Documents/sitename.com
ServerName sitename.localhost
<Directory Users/username/Documents/sitename.com>
Order allow,deny
Allow from all
</Directory>
Run Code Online (Sandbox Code Playgroud)
编辑:我有这个工作.根据http://www.acwolf.com/blog/2009/February/xampp-virtual-hosts-mac,在OSX中,有必要对httpd.conf进行两处更改,首先,取消注释
<VirtualHost *:80>
DocumentRoot Users/username/Documents/sitename.com
ServerName sitename.localhost
<Directory Users/username/Documents/sitename.com>
Order allow,deny
Allow from all
</Directory>
Run Code Online (Sandbox Code Playgroud)
第二,将用户从nobody更改为用于登录OSX的用户名.您可能还需要删除浏览器的缓存.
我想知道为什么图像的底部边框之间有垂直空间,并且在下面包含div:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><html xmlns:fb="http://www.facebook.com/2008/fbml"><!--facebook-->
<head><meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>test</title>
<style>
.box {
border:1px solid black;
}
.image {
border:1px solid red;
}
</style>
</head>
<body>
<div class="box">
<img class="image" src="http://i.imgur.com/o2udo.jpg" />
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 以下查询在1.6秒内执行
SET @num :=0, @current_shop_id := NULL, @current_product_id := NULL;
#this query limits the results of the query within it by row number (so that only 250 products get displayed per store)
SELECT * FROM (
#this query adds row numbers to the query within it
SELECT *, @num := IF( @current_shop_id = shop_id, IF(@current_product_id=product_id,@num,@num+1), 0) AS row_number, @current_shop_id := shop_id AS shop_dummy, @current_product_id := product_id AS product_dummy FROM (
SELECT shop, shops.shop_id AS
shop_id, p1.product_id AS
product_id
FROM products …
Run Code Online (Sandbox Code Playgroud) 我想在低I/O和CPU优先级下通过cron运行脚本.如果我理解正确(我可能不会),我可以添加proc_nice(10);
到我的脚本中以降低CPU优先级,但I/O优先级没有PHP等价物.
似乎有一个shell命令ionice
,但我是一个Linux白痴,我不知道我在做什么.如果我想使用nice和ionice来降低相关脚本的优先级,那么这是我的cron文件的正确行吗?
0 * * * * /usr/bin/nice -n 10 /usr/bin/ionice -c 3 /path/php/bin/php /path/script.php
Run Code Online (Sandbox Code Playgroud)
我-c3
从这里得到了参数("将进程放在空闲调度类中"),我不相信这就是我想要的.
使用PHP调用proc_nice()
而不是使用此方法有什么好处?
编辑:我的cron脚本没有使用上面的运行,所以我肯定误解了一些东西
以下代码用于检查模糊字段中是否输入了4个数字.如果不是,则删除字段值,并且该字段被聚焦.删除工作正常,但对focus()的调用不起作用.
$('input.dateValue').live('blur',function(event){
if (!(/(\d){4}$/.test($(this).attr('value')))) $(this).attr('value','').focus();
});
Run Code Online (Sandbox Code Playgroud)
为什么对焦点()的调用不关注该领域?
为什么这样呢
$html = '<a href="/browse/product.do?cid=1&vid=1&pid=1" class="productItemName">what is going on here</a>';
$dom = new DOMDocument();
$dom->loadhtml($html);
$xpath = new DOMXPath($dom);
$selectors['link'] = '//a/@href';
$links_nodeList = $xpath->query($selectors['link']);
foreach ($links_nodeList as $link) {
$links[] = $link->nodeValue;
}
echo("<p>links</p>");
echo("<pre>");
print_r($links);
echo("</pre>");
Run Code Online (Sandbox Code Playgroud)
产量
links
Array
(
[0] => /browse/product.do?cid=1&vid=1&pid=1
)
Run Code Online (Sandbox Code Playgroud)
并不是
links
Array
(
[0] => /browse/product.do?cid=1&vid=1&pid=1
)
Run Code Online (Sandbox Code Playgroud)
?
在诸如的MySQL查询中
SELECT *
FROM (
SELECT user_id
FROM favorites
WHERE user_id >1
UNION SELECT user_id
FROM favorites
WHERE user_id <9
) AS derived
Run Code Online (Sandbox Code Playgroud)
是不是别名收藏表(例如'朋友AS f1')我注意到这个查询按预期工作(即返回所有user_ids),但我不知道这样做是不好的做法.当我有一些UNION时,如果我不必直接保留所有别名,那么它会让我的查询不那么混乱.什么时候使用别名有一个很好的一般规则(也许它'在使用同一个表的多个实例时总是使用别名')?
我有以下脚本使用PHP 5.2.6返回本地服务器上图像的高度和宽度,但不使用5.2.17在我的共享主机帐户上.
ini_set('memory_limit', '32M');
list($width, $height, $type, $attr) = getimagesize("http://images.jcrew.com/erez4/erez?src=images/eiec/39/39251/39251_WO7826.tif&tmp=prdAr3");
echo "<img src=\"http://images.jcrew.com/erez4/erez?src=images/eiec/39/39251/39251_WO7826.tif&tmp=prdAr3\" $attr alt=\"getimagesize() example\" />";
Run Code Online (Sandbox Code Playgroud)
我尝试增加memory_limit
另一个问题中的建议.从其他站点获取图像的大小在本地和远程都可以正常工作,但对于此站点,仅在本地.可能会发生什么?
我有两个表,产品(product_id)和性别(product_id,sex_id).我试图从两个具有product_id的表中删除行,以便在sex_id和sex = 1的性别表中存在一行.到目前为止我有
CREATE TEMPORARY TABLE tempTable
SELECT p.product_id
FROM products AS p
INNER JOIN sex AS s
ON p.product_id = s.product_id
WHERE s.sex = 1;
DELETE FROM products AS p
NATURAL JOIN tempTable AS t
Run Code Online (Sandbox Code Playgroud)
DELETE查询抛出此错误:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NATURAL JOIN tempTable AS t' at line 2
Run Code Online (Sandbox Code Playgroud)
这个SELECT查询工作正常:
SELECT * FROM products
NATURAL JOIN tempTable …
Run Code Online (Sandbox Code Playgroud) 给出以下脚本
<?php
ini_set('display_errors','On');
error_reporting(E_ALL);
thisisanerror
?>
Run Code Online (Sandbox Code Playgroud)
我得到了预期
Notice: Use of undefined constant error - assumed 'error' in /htdocs/test.php on line 8
Run Code Online (Sandbox Code Playgroud)
但是如果我在脚本中添加一些内容
<?php
ini_set('display_errors','On');
error_reporting(E_ALL);
error
function test () {
echo('test');
}
?>
Run Code Online (Sandbox Code Playgroud)
我明白了
HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.
Run Code Online (Sandbox Code Playgroud)
为什么我在后一种情况下得到500错误而不是正常的语法错误?不应该display_errors总是显示错误?
php ×4
mysql ×3
apache ×1
cron ×1
css ×1
domdocument ×1
getimagesize ×1
html ×1
javascript ×1
jquery ×1
macos ×1
sql ×1
unix ×1
xampp ×1
xpath ×1