Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/254.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 为什么这个条纹请求没有';t设置客户';s描述为空?_Php_Laravel_Stripe Payments - Fatal编程技术网

Php 为什么这个条纹请求没有';t设置客户';s描述为空?

Php 为什么这个条纹请求没有';t设置客户';s描述为空?,php,laravel,stripe-payments,Php,Laravel,Stripe Payments,我试图使用PHP将Stripe中的客户描述设置为null,但目前无法 Stripe的API文档用于说明 这可以通过将值更新为null然后保存来取消设置 我正试图用拉威尔的tinker来做这件事 >>> $customer = Customer::retrieve('cus_AgcMLZIYr2XIZm'); => Stripe\Customer {#891} >>> $customer->description; => "Test" >

我试图使用PHP将Stripe中的客户描述设置为
null
,但目前无法

Stripe的API文档用于
说明

这可以通过将值更新为null然后保存来取消设置

我正试图用拉威尔的tinker来做这件事

>>> $customer = Customer::retrieve('cus_AgcMLZIYr2XIZm');
=> Stripe\Customer {#891}
>>> $customer->description;
=> "Test"
>>> Customer::update('cus_AgcMLZIYr2XIZm', ['description' => null]);
=> Stripe\Customer {#888}
>>> $customer = Customer::retrieve('cus_AgcMLZIYr2XIZm');
=> Stripe\Customer {#852}
>>> $customer->description;
=> "Test"
>>>
为什么客户的描述没有设置为空?我希望它会,但当我再次检索它时,它仍然设置为。如果我传递字符串,客户的描述将发生变化


Stripe的文档是否有误(看起来很荒谬,但我希望它能起作用)?

这是因为库无法区分
null
和根本没有设置的值之间的区别。如果您为描述传递空字符串
'
,而不是null,或者您执行以下操作,则此操作将正常工作:

 $customer = Customer::retrieve("cus_AgcMLZIYr2XIZm");
 $customer->description = null;
 $customer->save();

这是因为库无法区分
null
和根本未设置的值之间的区别。如果您为描述传递空字符串
'
,而不是null,或者您执行以下操作,则此操作将正常工作:

 $customer = Customer::retrieve("cus_AgcMLZIYr2XIZm");
 $customer->description = null;
 $customer->save();

也许
cus_AgcMLZIYr2XIZm
不支持null,您尝试过其他方法吗。像“文本”。也许
cus_AgcMLZIYr2XIZm
不支持空值,你试过别的吗。与“文本”类似。这可以工作,但不适用于
$customer->shipping->address->country=null您不能这样做吗?这可以工作,但不适用于
$customer->shipping->address->country=null