コード例 #1
0
ファイル: autoload_real.php プロジェクト: tianyunchong/php
 public static function getLoader()
 {
     if (null !== self::$loader) {
         return self::$loader;
     }
     spl_autoload_register(array('ComposerAutoloaderInit9d9ec52c7ca517098968508cff22c107', 'loadClassLoader'), true, true);
     self::$loader = $loader = new \Composer\Autoload\ClassLoader();
     spl_autoload_unregister(array('ComposerAutoloaderInit9d9ec52c7ca517098968508cff22c107', 'loadClassLoader'));
     $map = (require COMPOSER . '/autoload_namespaces.php');
     foreach ($map as $namespace => $path) {
         $loader->set($namespace, $path);
     }
     $map = (require COMPOSER . '/autoload_psr4.php');
     foreach ($map as $namespace => $path) {
         $loader->setPsr4($namespace, $path);
     }
     $classMap = (require COMPOSER . '/autoload_classmap.php');
     if ($classMap) {
         $loader->addClassMap($classMap);
     }
     $loader->register(true);
     return $loader;
 }
コード例 #2
0
ファイル: test.php プロジェクト: tianyunchong/php
<?php

/**
 * sphinxql测试产品搜索
 */
namespace Xz;

define("LIB", "/data/cap/gitwork/php/library");
define("COMPOSER", LIB . "/composer");
include_once "/data/cap/gitwork/php/library/SphinxQL/SphinxQL.php";
require_once LIB . "/composer/autoload_real.php";
\ComposerAutoloaderInit9d9ec52c7ca517098968508cff22c107::getLoader();
$sphinxConfig = array("host" => "172.17.17.105", "port" => 9020);
$cateid = 8408;
$keyword = "机床";
testAction($keyword, $cateid);
/* sphinxql测试 */
function testAction($cateid)
{
    $sphinxConfig = array("host" => "172.17.17.105", "port" => 9020);
    $conn = new \Foolz\SphinxQL\Connection();
    $conn->setParams(array('host' => $sphinxConfig["host"], 'port' => $sphinxConfig["port"]));
    $query = \Foolz\SphinxQL\SphinxQL::create($conn);
    $query->select(array("id", "cate3"))->from("product_distri_29");
    $query->where("cate3", "=", intval($cateid));
    $query->limit(0, 1000);
    $query->option("max_matches", 4000);
    try {
        echo $query->compileSelect()->getCompiled();
        echo "\n";
        exit;