Ограничение моно времени выполнения

Согласно функции PHP Documentation json_decode есть параметр с именем assoc , который преобразует возвращаемые объекты в ассоциативные массивы

 mixed json_decode ( string $json [, bool $assoc = FALSE ] )

С Параметр assoc по умолчанию имеет значение FALSE. Вам необходимо установить это значение на TRUE, чтобы получить массив.

Изучите приведенный ниже код для примера использования:

$json = '{"a":1,"b":2,"c":3,"d":4,"e":5}';
var_dump(json_decode($json));
var_dump(json_decode($json, true));

, который выводит:

object(stdClass)#1 (5) {
    ["a"] => int(1)
    ["b"] => int(2)
    ["c"] => int(3)
    ["d"] => int(4)
    ["e"] => int(5)
}

array(5) {
    ["a"] => int(1)
    ["b"] => int(2)
    ["c"] => int(3)
    ["d"] => int(4)
    ["e"] => int(5)
}

5
задан Community 23 May 2017 в 11:47
поделиться

3 ответа

Start by using the MoMA tool

The Mono Migration Analyzer (MoMA) tool helps you identify issues you may have when porting your .Net application to Mono. It helps pinpoint platform specific calls (P/Invoke) and areas that are not yet supported by the Mono project. While MoMA can help show potential issues, there are many complex factors that cannot be covered by a simple tool. MoMA may fail to point out areas that will cause problems, and may point out areas which will not actually be an issue

From Personal point: All C# 3.0 feature are supported well, I had no problem with LINQ (To Objects, don't know about LINQ to SQL or to XML) and NHiberinate also works well (although I didn't end up using in)

7
ответ дан 18 December 2019 в 09:52
поделиться

Will it just work? You really have to test it. I've just recently put effort into making Protocol Buffers work on Mono. I've had very little execution-time trouble so far; the compiler was more of an issue for me. However, I've had to temporarily disable one of the unit tests (using mocking) because it makes the Mono 2.4 VM itself go bang. I haven't investigated why yet, but that sort of thing is basically impossible to predict.

Anything which uses "deep" aspects of the CLR - such as expression trees and dynamic methods - is likely to have more problems than simple libraries, IMO.

Now, you say it's a Windows service - obviously Linux doesn't have services in quite the same way as Windows, so you'll need to work out how you want it to run. I'd start off by running it as a simple console app if I were you... once it's all working, you can think about integrating it with other "service" controllers etc - if you find you need to.

It certainly used to be the case that xbuild didn't provide a seamless migration path from building on Windows to building on Linux... however, it's had a lot of attention recently, so it's worth trying again...

8
ответ дан 18 December 2019 в 09:52
поделиться

The runtime should be fine but you can run the Mono Migration Analyzer.

2
ответ дан 18 December 2019 в 09:52
поделиться
Другие вопросы по тегам:

Похожие вопросы: