当我尝试使用自动加载和名称空间时,我收到此错误:
致命错误:类"的Class1"中找不到/usr/local/www/apache22/data/public/php5.3/test.php上线10
谁能告诉我我做错了什么?
这是我的代码:
Class1.php:
<?php
namespace Person\Barnes\David
{
class Class1
{
public function __construct()
{
echo __CLASS__;
}
}
}
?>
Run Code Online (Sandbox Code Playgroud)
test.php的:
<?php
function __autoload($class)
{
require $class . '.php';
}
use Person\Barnes\David;
$class = new Class1();
?>
Run Code Online (Sandbox Code Playgroud) 我似乎无法找到正确方向的指针,我甚至不确定我应该研究的条款是什么,但无数小时的谷歌搜索似乎在旋转我的圈子,所以希望堆栈智能的集体蜂巢溢出可以帮助.
问题是,我需要一种方法来过滤数据,我只能称之为复合逻辑树.目前,该系统实现了一个简单的AND过滤系统.例如,假设我们有一个人的数据集.你添加了一堆过滤器,显示所有人(性别=女性)和(年龄> 23)AND(年龄<30)和(状态=单身).很容易,遍历每个项目,只有在每个条件都为真时才添加到有效的项目集合.
我遇到的问题是如何处理用户能够构建涉及的复杂查询和/或?我正在考虑像每个节点所代表的树和表达式,将其子节点评估为真或假.一个简单的例子是 - 过滤到((性别= =男性和年龄= = 25)或(性别==女性和状态==单身))和智商> 120.对不起我想不出一个更好的例子在此时此刻.但是,您将如何表示此类型的表达式树,并针对这些过滤器评估集合中的项目.有哪些参考资料会有所帮助?天啊,谷歌搜索什么可能会导致一个积极的方向?!
感谢任何可以提供任何帮助的人.
以下是使用人员数据集的树形式的复合查询示例
所以在树形式即时思考
o-Root Node
- And - Sex = Male
- And - Eyes = Blue
- Or - Sex = Female
- And Eyes = Blue
- Or Status = Single
Run Code Online (Sandbox Code Playgroud)
我相信解决方案是在数据结构中表示每个节点
Node
{
OpType - AND or OR
ExpressionField - The field to evaluate
ExpressionOp - =, !=, >, >=, <, <=
ExpressionValue - the value to compare the field's value against …
Run Code Online (Sandbox Code Playgroud) user-interface boolean-logic expression-trees expression-evaluation decision-tree
是否有可能建立一个什么都不做的链接.我想要项目是一个链接,所以我让光标在鼠标悬停时更改,但我不希望链接实际上去任何地方,因为它实际上触发在同一页面上显示具有额外功能的div.
我创建了自己的灯箱,问题是它显示在我的显示器上,而不是更宽的显示器或更大的分辨率.
在所有分辨率/监视器/浏览器中居中div的最佳方法是什么?
在我的应用程序中,我使用的是自定义表.每个细胞都有一个uibutton和uiimage.当触摸按下按钮时,我想调用uiimagepickercontroller方法从iphone库中选择一张图片并将其显示在图像视图中.我已经写了但收到警告......'customCell'可能无法响应presentmodalviewcontroller动画...这里customCell是我的主类myApp的子类,也是自定义单元格的nib的名称.谁知道这个问题???? 谢谢...
编辑
- (IBAction)selectExistingPicture1 {
if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypePhotoLibrary]) {
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsImageEditing = YES;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentModalViewController:picker animated:YES];
[picker release];
}
else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error accessing photo library" message:@"Device does not support a photo library" delegate:nil cancelButtonTitle:@"Drat!" otherButtonTitles:nil];
[alert show];
[alert release];
}
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo {
CGSize newSize = CGSizeMake(80, 80);
UIGraphicsBeginImageContext( newSize );
[image drawInRect:CGRectMake(0,0,newSize.width,newSize.height)];
UIImage* newImage = …
Run Code Online (Sandbox Code Playgroud) 是否有一个PHP字符串函数来修剪特定字符后的字符串.我在php.net网站上看了一下并进行了谷歌搜索但找不到任何东西.我能想到的唯一解决方案是爆炸,然后抓住阵列的第一部分,但这不是最优雅的解决方案.
例如
$string = "/gallery/image?a=b";
$string = imaginary_function($string,'?');
echo $string; //echoes "/gallery/image"
Run Code Online (Sandbox Code Playgroud)
有谁知道php字符串操作函数的好的备忘单?谢谢
嗨我已经尝试了大量的"谷歌搜索"片段来禁用输入/返回键但没有任何工作.有关如何在tinyMCE textarea中禁用输入/返回键的任何想法?
我正在尝试创建一个接受泛型的函数,List<T>
并迭代返回excel文件的列表byte[]
.该函数需要能够确定对象属性.因此,如果我传递一个List<person>
人和人有属性first,last,age等我需要能够确定属性名称以创建excel列标题然后我需要迭代列表以将属性值分配给列细胞.任何人都可以指出一些List<T>
在泛型函数中使用的示例代码吗?
我觉得这个问题可能已经被问过了一千次,所以如果有人回答,我会道歉.如果是这样,有人能指出我正确的帖子/链接?
我要做的是为我的网站构建一个分面导航.它使用MySQL,这里是我正在使用的表的草图:
products: - id - title - description
attributes: - product_id - name - value
categories: - id - name
products_to_categories: - product_id - category_id
我想要做的是当你在一个类别时显示可用属性列表,允许你为每个属性选择一个或多个值.举个例子,请查看Office Depot的这个页面:http://www.officedepot.com/a/browse/binders/N=5+2177/
到目前为止,我已经使用了很多连接来过滤多个属性:
SELECT products.*, a_options.* FROM products_to_categories AS pc, products, attributes AS a_options, /* list of attribute/value pairs I can continue to refine on */ attributes AS a_select1 /* first selected attribute */ attributes AS a_select2 /* second selected attribute */ ... WHERE pc.category_id = 1 AND products.id = pc.product_id …
如何开发一个可以从字母表(a,b,.... z)返回随机字符(单个字符)的扩展方法.
public static char RandomLetter(this char randomchar)
{
}
Run Code Online (Sandbox Code Playgroud) c# ×2
html ×2
javascript ×2
php ×2
autoload ×1
css ×1
excel ×1
generic-list ×1
hyperlink ×1
iphone ×1
mysql ×1
string ×1
uitableview ×1