$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>database - Structure of postmeta meta_value for woocommerce product download|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

database - Structure of postmeta meta_value for woocommerce product download

matteradmin10PV0评论

So I'm working on a monster script to port all of our existing stuff from Joomla/Virtuemart to Wordpress/WooCommerce.

So far I've got just about everything done with moving over our product categories and products, I just need to figure out the structure of the _downloadable_files postmeta.

Using this as an example:

a:1:{s:32:"ded830cf64e3c42c4f7ac5aecd7c5c86";a:2:{s:4:"name";s:0:"";s:4:"file";s:114:"http://localhost/wp-content/uploads/woocommerce_uploads/2014/09/test-file.pdf";}}

How is the s:114 just before the file url generated? That is the only part that changes that I don't know how to generate.

Any suggestions would be greatly appreciated!

So I'm working on a monster script to port all of our existing stuff from Joomla/Virtuemart to Wordpress/WooCommerce.

So far I've got just about everything done with moving over our product categories and products, I just need to figure out the structure of the _downloadable_files postmeta.

Using this as an example:

a:1:{s:32:"ded830cf64e3c42c4f7ac5aecd7c5c86";a:2:{s:4:"name";s:0:"";s:4:"file";s:114:"http://localhost/wp-content/uploads/woocommerce_uploads/2014/09/test-file.pdf";}}

How is the s:114 just before the file url generated? That is the only part that changes that I don't know how to generate.

Any suggestions would be greatly appreciated!

Share Improve this question edited Jul 23, 2015 at 16:42 Pieter Goosen 55.5k23 gold badges117 silver badges211 bronze badges asked Jul 23, 2015 at 16:01 JakeJake 133 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

In short, this is serialized data and this is how data is stored from a custom field (and many other datastrings) in the db.

s:114 is auto generated and simply means that the value http://localhost/wp-content/uploads/woocommerce_uploads/2014/09/test-file.pdf is a string and is 114 characters long. This is used when the data is read and used. If the URL value changes, the string length will change as the length of the string changes

You will need to go and have a look at data serializing and unserializing

Post a comment

comment list (0)

  1. No comments so far