小编ehi*_*ime的帖子

访问嵌套对象数组

嘿家伙我似乎无法在这里得到语法,我只是想看看类型是否存在,我已经尝试过了

if($obj->type)    /* do something */
if($obj[0]->type) /* do something */
if($obj->type[0]) /* do something */
Run Code Online (Sandbox Code Playgroud)

就这个

stdClass::__set_state(
array(
   '0' => 
  stdClass::__set_state(
  array(
     'report_number' => '555',
     'type' => 'citrus',
     'region' => 'Seattle',
     'customer_number' => '9757',
     'customer' => 'The Name',
     'location' => 'West Seattle, WA',
     'shipper' => 'Yamato Transport',
     'po' => '33215',
     'commodity' => 'RARE',
     'label' => 'PRODUCE',
  )),
))
Run Code Online (Sandbox Code Playgroud)

但似乎无法做到正确,我相信它与[0]是一个int而不是varchar有关,但我不知道....

php oop object

1
推荐指数
1
解决办法
7889
查看次数

MySQL代码的问题?

我在PRIMARY KEY附近遇到了一个错误,但无法确定究竟是什么,有人可以看看吗?

CREATE TABLE `reports` (

    `key`                   INT UNSIGNED AUTO_INCREMENT, 
    `role`                  VARCHAR(70), 
    `region`                VARCHAR(70),
    `inspection_type`       VARCHAR(70),
    `inspection_number`     VARCHAR(70),
    `customer_number`       VARCHAR(70),

    `report_date`           DATE DEFAULT NULL,  



    `order_date`            DATE DEFAULT NULL,  


    `customer`              VARCHAR(70),
    `customer_division`     VARCHAR(70),
    `location`              VARCHAR(70),
    `memo`                  VARCHAR(255),       
    `billingkey`            VARCHAR(70),

    PRIMARY KEY(key)

) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
Run Code Online (Sandbox Code Playgroud)

mysql primary-key create-table

0
推荐指数
1
解决办法
64
查看次数

正则表达式在两个条件下运行

嘿伙计这应该很简单,我只是没有看到它,我想创建一个正则表达式(可在PERL,Awk,SED/*nix下工作),它将在找到领先的现金($)之后运行,下一个等于(=)并处理双引号或单引号的最后一个实例的双引号或单引号的第一个实例之间的内容.

让我举几个例子.

$this = 'operate on some text in here'; # operates between single quotes
$this = "operate on some text in here"; # operates between double quotes
$this = 'operate "on some text" in here'; # operates between single quotes
$this = 'operate \'on some text\' in here'; # operates between outer single quotes
Run Code Online (Sandbox Code Playgroud)

我尝试了一些非常糟糕的正则表达式.但只是无法让它匹配正确.

这是我插入的内容,以防任何人感兴趣

printf '$request1 = "select * from whatever where this = that and active = 1 order by something asc";\n' |
grep '{regex}' * …
Run Code Online (Sandbox Code Playgroud)

regex perl awk sed

0
推荐指数
1
解决办法
169
查看次数

Mysql必须格式化才能输入?

这真的很奇怪,也许有人知道答案,

我有一张这样的桌子

mysql> describe sweeps;
+----------------+------------------+------+-----+---------------------+-----------------------------+
| Field          | Type             | Null | Key | Default             | Extra                       |
+----------------+------------------+------+-----+---------------------+-----------------------------+
| entity_id      | int(20) unsigned | NO   | PRI | NULL                | auto_increment              |
| fb_id          | varchar(120)     | YES  |     | NULL                |                             |
| title          | varchar(5)       | YES  |     | NULL                |                             |
| first_name     | varchar(30)      | YES  |     | NULL                |                             |
| last_name      | varchar(30)      | YES  |     | NULL                |                             |
| birthday_month …
Run Code Online (Sandbox Code Playgroud)

mysql insert

0
推荐指数
1
解决办法
66
查看次数

PHP Lambda函数

嘿家伙我搞砸了我的Lambda,似乎我的匿名函数没有得到上面的变量,

进入的一些变革是

print_r($cacheTypes); 
print_r($servers); 

Array
(
    [concreter] => on
    [config] => on
)
Array
(
    [0] => dev-www.domain.com
)
Run Code Online (Sandbox Code Playgroud)

功能是

$urls = array_walk($servers, 
    create_function('&$n', 
        '$n = "http://{$server}/".($vcpParam 
            ? "flush-file-cache" 
            : "flushFileCache.php"
        )."?tags=".implode("-", array_keys($cacheTypes));'
    )
);
Run Code Online (Sandbox Code Playgroud)

错误是

Warning: array_keys() expects parameter 1 to be array, null given
Warning: implode() [<a href='function.implode'>function.implode</a>]: Invalid arguments passed
Run Code Online (Sandbox Code Playgroud)

非常感谢.我很肯定它没有认识到我正在输入的变量,但我不确定为什么

php lambda anonymous-function

0
推荐指数
1
解决办法
1001
查看次数

标签 统计

mysql ×2

php ×2

anonymous-function ×1

awk ×1

create-table ×1

insert ×1

lambda ×1

object ×1

oop ×1

perl ×1

primary-key ×1

regex ×1

sed ×1