Регистрация на Блоггера, использующего PHP

Прежде всего высказывание Objective C "безумно", является юмористическим - у меня есть книга C++ Bjarne Stroustrup, сидящая у моей стороны, которая начинает работу на уровне 1 020 страниц. PDF Apple на Objective C равняется 141.

, Если Вы хотите использовать UIKit, для Вас будет очень, очень трудно сделать что-либо в C++. Для любого серьезного приложения для iPhone, которое соответствует UI Apple, будет нужно, это - части UI, которые будут записаны в Objective C. Только если Вы пишете, что игра OpenGL может Вы придерживаться почти полностью C/C++.

5
задан Jeff Atwood 17 August 2009 в 11:11
поделиться

1 ответ

Your $gdClient variable is intanciated outside of the createPublishedPost function :

$gdClient = new Zend_Gdata($client); 

Inside a function, the variables that have been defined outside of it don't exist by default.
About that, you can take a look at the Variable scope page of the manual.

This means $gdClient doesn't exist inside the function ; hence, it is null ; so, not an object -- which explains the error message you are getting.


To check that by yourself, you can use

var_dump($gdClient);

at the beginning of the function : it will allow you to see what kind of data it is ; if it's not an instance of the class you are willing to use, it's not a good sign ;-)


You might want to either :

  • pass that variable as a parameter to the createPublishedPost function
  • or declare it as global inside the function (so the function can "see" the variable as declared outside)

The first solution is probably the cleanest one, I think ;-)


As a sidenote, you might want to configure your error_reporting level (see also), so you get an E_NOTICE when you are using a variable that is not declared -- in this case, you should have gotten one, for instance ;-)
You might also want to enable display_errors, on your development machine, if it's not already on -- seems to be, as you got the Fatal error message

It might seem a bit annoying at the beginning, but, once you get used to it, it is really great : allow to detect that kind of stuff a lot quicker ;-)
And it also helps detect typos in variable names ^^
And it makes you code way cleaner !

6
ответ дан 14 December 2019 в 08:56
поделиться
Другие вопросы по тегам:

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