JSON not working in PHP?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
8 views
Hello, respected Hebraist.

I had a problem, very much hope that we will be able to solve.


But the problem lies in the fact that the functions json_encode() and json_decode() on my hosting is not working.


In normal use, an error occurs:

Fatal error: Call to undefined function json_encode() in ***.php



When you use a helper for Code Igniter, an error occurs:

Message: Undefined variable: json

Filename: helpers/json_helper.php

Line Number: 53

Fatal error: Call to a member function encode() on a non-object in ...\\system\\application\\helpers\\json_helper.php on line 53
by | 8 views

7 Answers

0 like 0 dislike
Found myself an alternative, if anyone face with the same. Thank you all.
by
0 like 0 dislike
If possible, it is best to upgrade php to version 5.2 or 5.3, then they will work the functions json_encode() and json_decode().
\r
Otherwise, you need to watch that there is a not declared variable in CI, or to use other implementation of these functions.
by
0 like 0 dislike
Please contact our technical support hosting provider that they have compiled fully (with the included extension JSON) version of PHP.
by
0 like 0 dislike
In an extreme case, it is possible to write similar functions json_encode() and json_decode(), if it is not possible to change the host and/or php distribution.
by
0 like 0 dislike
by
0 like 0 dislike
Other bikes a little chtoli? And it is better to throw such hosting.
by
0 like 0 dislike
In this case as the output (without a showdown with the hoster) can recommend to use classes
Zend_Json_Encoder and to declare the functions json_encode() and json_decode() in global scope, inside of which respectively call Zend_Json_Encoder::encode()/decode().
The method is of course clumsy, but if there is no other option, then you can try.
Cm. framework.zend.com/manual/en/zend.json.basics.html
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
110,608 questions
257,186 answers
0 comments
28,102 users